Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.