This week's book giveaway is in the Agile forum.
We're giving away four copies of The Software Craftsman and have Sandro Mancuso on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Max no of Connections in MySql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Max no of Connections in MySql" Watch "Max no of Connections in MySql" New topic

Max no of Connections in MySql

Senthil Manoharan

Joined: Mar 01, 2010
Posts: 28
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 and Regards
Senthil Kumar M
Jan Cumps

Joined: Dec 20, 2006
Posts: 2532

Hi Senthil ,
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

OCUP UML fundamental and ITIL foundation
youtube channel
Peter Johnson

Joined: May 14, 2008
Posts: 5850

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.

JBoss In Action
I agree. Here's the link:
subject: Max no of Connections in MySql