开发者

postgres connections exceeding max_connections?

we are running a very connection-heavy, insert-heavy postgres database (to the point that we should've done some connection pooling, but there's no time now).

when doing some troubleshooting, i was using netstat to show me how many connections there were to postgres. i would commonly see more than what i had specified in the postgres.conf file (via max_connections).

i would see 1400-1600 connections via netstat even though i had max_connections set to 1000.

anyone have any clue what is 开发者_如何学JAVAgoing on? how exactly can this happen?

any insight on this would be great.


Is it possible that those connections were already closed? Windows for example doesn't immediately close the connection, but it changes it state to "TIME_WAITING.

So the connections show up in netsat but are actually closed.

Only those that show up as "ESTABLISHED" are "live" connections.

Btw: you can simply put a connection pooler in front of your PostgreSQL server without changing your application. pgPool (or pgBouncer) will pretend they are a real PostgreSQL server to the application and will do the pooling "behind its back"


Use a connectionpool. More than a 1000 connections will slow down the database significantly and even for a 1000 connections you need some $$$$$ hardware with a lot of cores and RAM. Using a connectionpool is much more efficient.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜