1

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?

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.

4
  • 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 Dec 22 '18 at 16:48
  • 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 Dec 23 '18 at 1:22
  • 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.” blog.softsyshosting.com/2017/08/01/… – Vaughn D. Taylor Dec 23 '18 at 1:30
  • 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 Dec 23 '18 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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