Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Max no of Connections in MySql  RSS feed

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I would like to know how many DB(MYSQL) connections can made at a single time? I'm creating a website, which has to handle 10,000 + user at a single time.
can anyone help me?
Thanks
 
Bartender
Posts: 2633
17
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Senthil ,

The maximum number of connections MySQL can support depends on the quality of the thread library on a given platform, the amount of RAM available, ...

When developing a web site, you should not reserve one connection per user.

Such an application typically has a pool of connections available. The application shortly picks one of the connections in the pool to perform short database interactions, and returns it to the pool.

Look for Connection Pooling.

Regards, Jan
 
author
Bartender
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends a lot on what you mean by 10000 users. Registered users? Logged in users? Users making simultaneous requests?

Here is one possible way to calculate the required connection pool size: If you assume that each user will spend 5 minutes thinking before entering a request, and each request takes 1 second to process, then you have about 33 simultaneous users (5 min == 300 seconds, so if you had only 300 users you would have 1 request at a time; 10000 / 300 ~= 33). If only 1/2 of the requests require a database connection, then a pool of 16 connections should be sufficient.

On another topic, I recall reading somewhere that MySQL can handle around 500 connections. That depends on the amount of memory and processor speed (you won't get that on a netbook!). Given the above calculations, you could handle 100s of thousands of users.

On more thought - Java EE application servers have built-in database connection pools. Read the docs for your app server to see how to go about configuring such a pool.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!