<p>In MySQL, there's a "max_connections" variable: <a href="https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_connections" rel="nofollow noreferrer">https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_connections</a></p>

<p>In Apache (assuming you're using Apache) there's a "MaxClients" directive: <a href="http://web.archive.org/web/20160415001028/http://www.genericarticles.com/mediawiki/index.php?title=How_to_optimize_apache_web_server_for_maximum_concurrent_connections_or_increase_max_clients_in_apache" rel="nofollow noreferrer">http://web.archive.org/web/20160415001028/http://www.genericarticles.com/mediawiki/index.php?title=How_to_optimize_apache_web_server_for_maximum_concurrent_connections_or_increase_max_clients_in_apache</a></p>

<p>I'm not sure of your situation, but you may need to modify both of these to achieve what you need. These settings are not controlled through CraftCMS, but instead need to be controlled by editing your server environment configs.</p>

CC BY-SA 4.0
2018-12-22T16:48:19.440Z
I mean, how can i estimate # of mysql / apache connections needed if i expect there will be 1000 concurrent sessions? should I assume 1000 mysql and apache connections? or for every session, for example 2 mysql connections will be open?
lloyd
CC BY-SA 4.0
2018-12-23T01:22:52.660Z
I see what you’re asking, but the answer is impossible to know without knowing how efficiently you’re writing your code, how many pages are being served, is caching used, etc. Either way, this question is not Craft related. The best advice I can give you is that if you expect 1000 concurrent users, you’ll need a robust servers and consider a load balancer.
Vaughn D. Taylor
CC BY-SA 4.0
2018-12-23T01:30:55.873Z
A simple web search returned this (I cannot speak to the accuracy of this calculation): “Determining the RAM Resource - Once virtual users (concurrent users) are known, you can easily calculate the RAM usage. Let’s say your application will get at least 100 concurrent users which may burst to 200 in peak hours. Your application requires at least 16 MB private memory to run optimally. In this particular case, you’ll need (200 * 16 MB) 3.2 GB RAM to accommodate the 200 concurrent users.” http://blog.softsyshosting.com/2017/08/01/how-to-estimate-your-dedicated-server-resource-requirements/
Vaughn D. Taylor
CC BY-SA 4.0
2018-12-23T17:05:43.990Z
Hi @lloyd, I'm glad I could help. If my answer is what you were looking for, feel free to accept it so I get credit.
Vaughn D. Taylor
CC BY-SA 4.0
2018-12-22T15:37:50.827Z
2018-12-22T15:43:48.597Z
2018-12-22T15:43:48.597Z
Vaughn D. Taylor
<p>Assume my website (developed using Craft, of course) is expected to have 1000 concurrent access. How many MySQL db connections would be required to open? Does Craft control this or does it depend on program code?</p>

<mysql>
# of MySQL connections
# # of MySQL connections

(Asked by: username_0 on 2018-12-22)

Assume my website (developed using Craft, of course) is expected to have 1000 concurrent access. How many MySQL db connections would be required to open? Does Craft control this or does it depend on program code?

**Tags:** mysql

---

## 1 answers

### Answer by username_1 on 2018-12-22. Score: 2

In MySQL, there's a "max\_connections" variable: <https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_connections>

In Apache (assuming you're using Apache) there's a "MaxClients" directive: <http://web.archive.org/web/20160415001028/http://www.genericarticles.com/mediawiki/index.php?title=How_to_optimize_apache_web_server_for_maximum_concurrent_connections_or_increase_max_clients_in_apache>

I'm not sure of your situation, but you may need to modify both of these to achieve what you need. These settings are not controlled through CraftCMS, but instead need to be controlled by editing your server environment configs.

> **Comments:**
> **username_0**: I mean, how can i estimate # of mysql / apache connections needed if i expect there will be 1000 concurrent sessions? should I assume 1000 mysql and apache connections? or for every session, for example 2 mysql connections will be open?  
> **username_1**: I see what you’re asking, but the answer is impossible to know without knowing how efficiently you’re writing your code, how many pages are being served, is caching used, etc. Either way, this question is not Craft related. The best advice I can give you is that if you expect 1000 concurrent users, you’ll need a robust servers and consider a load balancer.  
> **username_1**: A simple web search returned this (I cannot speak to the accuracy of this calculation): “Determining the RAM Resource - Once virtual users (concurrent users) are known, you can easily calculate the RAM usage. Let’s say your application will get at least 100 concurrent users which may burst to 200 in peak hours. Your application requires at least 16 MB private memory to run optimally. In this particular case, you’ll need (200 * 16 MB) 3.2 GB RAM to accommodate the 200 concurrent users.” http://blog.softsyshosting.com/2017/08/01/how-to-estimate-your-dedicated-server-resource-requirements/  
> **username_1**: Hi @lloyd, I'm glad I could help. If my answer is what you were looking for, feel free to accept it so I get credit.  

---

