how to calculate this values to get the best results to resolve this error "too many connection error mysql" and make my API faster in mysql

   wait_timeout = ??
   max_connections = ??
   max_user_connections = ??
   key_buffer = ??
   query_cache_size = ??
   query_cache_limit = ??
   tmp_table_size = ??
   table_cache = ??
   max_concurrent_transactions ?? 
   max_concurrent_queries ??

and in apache 2

   ServerLimit ??
   StartServers ??
   MaxClients ??
   MinSpareThreads ??
   MaxSpareThreads ??
   ThreadsPerChild ??

what values should i set to this variable to get the best performance

system specification

amazon RDS 100GB DB STORAGE db.t1.micro

1 amazon LBS having two node attached to it each with

   amazon EC2 m1.small 1.7 GB RAM and 8 GB MAGNETIC HARD DISK 

1 Answer 1


Before deciding on value for max_connections I suggest that you look at WHY it reached the max_connection condition. A bunch of sleeping/idle connection due to loose coding is very common cause. Check if you have proper value for wait_timeout and adjust if this is your symptom.

Besides that, I would check for INSERT/UPDATE query that holds table locks for too long, as well as slow queries that get piled up once in a while.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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