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

I'm using Asp.Net together with MySQL. In the .Net connection string, I have set Max Pool Size to 150.

If I run the following I get these values:

SHOW GLOBAL STATUS LIKE 'max_used_connections'; gives 66
SHOW GLOBAL STATUS LIKE 'Threads_created'; gives 66
SHOW GLOBAL STATUS LIKE 'connections'; gives 474

Which gives Threads_created / Connections = 0,1392. 

So from that it seems like I need to increase thread_cache_size .

But if I run SHOW PROCESSLIST I always see that I have a lot of connections open (most of them sleeping) because of the pool created by .Net. Do I still need to set the thread_cache_size as I still will reuse the connections from the connection pool? If the Pool Size is 150 do you think a good value would be to set thread_cache_size to 150+? Would this affect CPU and memory a lot?

share|improve this question

1 Answer 1

Based on the info in the MySQL Documentation you should do the following: Find out what the highest number of simultaneous connections mysqld has had using Connections, Threads_created, and Max_used_connections,

  • SHOW GLOBAL STATUS LIKE 'Connections';
  • SHOW GLOBAL STATUS LIKE 'Threads_created';
  • SHOW GLOBAL STATUS LIKE 'Max_used_connections';

Try calculating the following

Threads_created / Connections : If this is over 0.01, then increase thread_cache_size. At the very least, thread_cache_size should be greater than Max_used_connections.

share|improve this answer
    
Thanks for great comment! I updated my question a little bit. –  Martin Jul 19 '12 at 6:59
    
I think you were intending mysql> SHOW GLOBAL STATUS LIKE 'connections'; (you have written max_used_connections twice) –  Alekc Oct 11 '12 at 7:15

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.