开发者

mysql => too many connection

I'm writing a program on Linux that needs to have lots of simultaneous connections. It's working fine for 150 connections but for more than that mysql gives this error: "Too many mysql connections"

From 开发者_如何学Pythonhere, apparently this limitation can be fixed. My question is that to what number I can increase the maximum number of connections?! How much RAM for each thread or connection?

Is pthread good enough for this application?

Thanks a lot


If you've got a three-tier application (i.e. your application runs on some application server and users connect to it using either a browser or a dedicated client), then a connection pool might help you.

The idea is to keep a pool of open connections and only take from that pool as needed and to return the connection to the pool as quickly as possible.

This way the actual number of open connections should be much lower than the number of active sessions/users.


Might connection pooling be of use? or does your application have to have 150+ connections open at the same time? I find it hard to belive that you need to have 150 concurrent connections. A bit more information on what you are trying to do would be helpful.


You have to set max_connections more than 151 to login with user and password of your mysql server.

set global max_connections = 15000;


Usually, service mysqld restart --max-connections=500 will do the job for you.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜