2

What is the best way to increase the max connections?

I plan on hitting my DB with a lot of connections (hundreds/thousands per second, they will open and close pretty quick from a multi threaded app). I am running MySQL on Ubuntu.

1 Answer 1

2

First answer is DON'T. In almost all scenarios a high amount of max connections is bad, as you will be wasting a large amount of resources for very little gain. Instead what you should be doing is to create a connection pool and reuse your connections. It will give you way better performance (both in ram and latency), especially if you are doing thousands of transactions per second.

To change the max connections value you use max connections: http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_max_connections

Your OS and RAM is likely the limiting factor. Unless you have a huge amount of ram you are unlikely to be able to serve more than a few thousand connections at the same time.

Also, have a look at http://dev.mysql.com/doc/refman/5.5/en/too-many-connections.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .