-
Notifications
You must be signed in to change notification settings - Fork 93
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
how to limit number of connections? #52
Comments
In what environment are you using pgmoon? It doesn't include a connection pool implementation. If you're using openresty then you can use the |
Yes, I'm using openresty environment. I tried size parameter on nginx socket, but it's not working, over size connections is not discarded. Need to create some tests for you? |
I was under the impression that
Not very fine-grained, I admit. Alternatively you could install a connection pooler like pgbouncer and using max_db_connections. This would allow your code to connect at will but prevent overloading the database with open sockets. |
I change the pgmoon/init.lua file, function keepalive: |
In truth, just put "lua_socket_pool_size" to your nginx.conf |
in my postgresql.conf: in my nginx.conf in my test.lua file: when I use ab to test: postgresql reports many below messages in log file: |
add: |
I don't think limiting number of connections is in the domain of this library, so I'm going to close the ticket. |
High loads and slow db responses can generate a large number of connections. There should be a limit of simultaneous db connections.
The text was updated successfully, but these errors were encountered: