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

Questions about MaxIdleConns #90

Open
time2k opened this issue Nov 27, 2018 · 1 comment
Open

Questions about MaxIdleConns #90

time2k opened this issue Nov 27, 2018 · 1 comment

Comments

@time2k
Copy link

time2k commented Nov 27, 2018

On the begining I set MaxIdleConns to 1 then did pressure test,I got "read: connection reset by peer" or "broken pipe" or "connect: can't assign requested address" panic

then I notice that MaxIdleConns with commend "Consider your expected traffic rates and latency carefully. This should be set to a number higher than your peak parallel requests."

so I set MaxIdleConns to 100+ and the light pressure test is ok
I check the tcp connect with memcached server , exactly 100 ESTABLISHED connect
but when pressure test over , the connects doesn't decrease

On my understanding, MaxIdleConns means to avoid low connect duration cost, make some basic connects to server the normal request. on busy time, it should increase the connect as much as the peak parallel requests, on idle time, it decrease to the MaxIdleConns setting number. It base on my experience on go-sql-driver/mysql and go-redis/redis, but when i turn MaxIdleConns lower than my parallel-pressture, it is show the panic above

Is my wrong understanding? is it exists a cycle timer to recycle the idle persistent connect? or some other recycle mechanism?

@time2k
Copy link
Author

time2k commented Nov 28, 2018

After carefully read source code of this project, i know that the Client getConn() func provide connection primary from freeconn Client defined, if not, dial new connect. When job finish put into freeconn, if freeconn length more than MaxIdleConns close this connection. It design fine and should work fine.

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

1 participant