Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QQs: try an alternative process name in case of a conflict #11888

Closed
wants to merge 3 commits into from

Commits on Jul 31, 2024

  1. Configuration menu
    Copy the full SHA
    1be524a View commit details
    Browse the repository at this point in the history

Commits on Aug 2, 2024

  1. Configuration menu
    Copy the full SHA
    28eb363 View commit details
    Browse the repository at this point in the history
  2. Speed up AMQP connection and session (de)registration

     ## What?
    
    Prior to this commit connecting 40k AMQP clients with 5 sessions each,
    i.e. 200k sessions in total, took 7m55s.
    
    After to this commit the same scenario takes 1m37s.
    
    Additionally, prior to this commit, disconnecting all connections and sessions
    at once caused the pg process to become overloaded taking ~14 minutes to
    process its mailbox.
    
    After this commit, these same deregistrations take less than 5 seconds.
    
    To repro:
    ```go
    
    package main
    
    import (
    	"context"
    	"log"
    	"time"
    
    	"github.com/Azure/go-amqp"
    )
    
    func main() {
    	for i := 0; i < 40_000; i++ {
    		if i%1000 == 0 {
    			log.Printf("opened %d connections", i)
    		}
    		conn, err := amqp.Dial(
    			context.TODO(),
    			"amqp://localhost",
    			&amqp.ConnOptions{SASLType: amqp.SASLTypeAnonymous()})
    		if err != nil {
    			log.Fatal("open connection:", err)
    		}
    		for j := 0; j < 5; j++ {
    			_, err = conn.NewSession(context.TODO(), nil)
    			if err != nil {
    				log.Fatal("begin session:", err)
    			}
    		}
    	}
    	log.Println("opened all connections")
    	time.Sleep(5 * time.Hour)
    }
    ```
    
     ## How?
    
    This commit uses separate pg scopes (that is processes and ETS tables) to register
    AMQP connections and AMQP sessions. Since each Pid is now its own group,
    registration and deregistration is fast.
    ansd authored and michaelklishin committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    965175b View commit details
    Browse the repository at this point in the history