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

no free connections available to host #1768

Open
imtiazwazir opened this issue Apr 24, 2024 · 3 comments
Open

no free connections available to host #1768

imtiazwazir opened this issue Apr 24, 2024 · 3 comments

Comments

@imtiazwazir
Copy link

I have following server setup and getting "no free connections available to host" any reason why? I did try many variations but none worked.

server := &fasthttp.Server{
	Handler:            router.Handler,
	ReadBufferSize:     util.KBToBytes(16),
	WriteBufferSize:    util.KBToBytes(16),
	ReadTimeout:        time.Millisecond * 600,
	WriteTimeout:       time.Millisecond * 600,
	// IdleTimeout:        time.Second * 2,
	MaxRequestBodySize: util.MBToBytes(8),
	ReduceMemoryUsage:  false,
	MaxConnsPerIP:      10000,
	MaxRequestsPerConn: 10000,
	Concurrency:        1024 * 1024,
	LogAllErrors:       false,
	// TCPKeepalive:       true,
	// TCPKeepalivePeriod: time.Minute * 5,
}

config.Logger.Info("Server is starting on port 8080...")

if err := server.ListenAndServe(":8080"); err != nil {
	config.Logger.Error("Error in ListenAndServe", "err", err)
}
@erikdubbelboer
Copy link
Collaborator

What is generating the no free connections available to host message? Have you tried measuring how many concurrent requests you are receiving and if 10000 connections is enough for that?

I would not set MaxRequestsPerConn if not needed. This will force close connections after this many requests and is only needed for broken clients.

@imtiazwazir
Copy link
Author

the thing is requests never reached to that value and still I am seeing that error no free connections available to host I am not sure if .Server also account 512 requests

@erikdubbelboer
Copy link
Collaborator

How many requests are you sending per second before you get that error? How long does your handler take to send a response?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants