简体   繁体   English

如何实际检查服务器是否可以同时处理多个MySQL连接

[英]How to practically check whether server can handle many MySQL connections simultaneously

I am new at server-side scripting. 我是服务器端脚本编写的新手。 On my website, I have MySQL database of users. 在我的网站上,我有MySQL用户数据库。 My website is supposed to host an event where all the users will be logging in and answering some questions. 我的网站应该举办一个活动,所有用户都将登录并回答一些问题。 So there will be a lot of MySQL queries submitted, to check whether what they have entered is correct or not. 因此,将提交许多MySQL查询,以检查它们输入的内容是否正确。 And in the event, the users can submit again and again until the answer is correct. 并且,在这种情况下,用户可以一次又一次提交,直到答案正确为止。

My question is, instead of going into the specifications of server to estimate the maximum concurrent MySQL connections, is there a way to practically get that? 我的问题是,除了进入服务器的规格来估计最大并发MySQL连接数之外,还有没有一种方法可以切实地做到这一点? What I mean is, is there some way (some function or algorithm), which will put similar load on the server as number of users submitting queries simultaneously. 我的意思是,有某种方法(某些函数或算法),与同时提交查询的用户数量一样,这将对服务器造成类似的负担。 Sort of like a test run. 有点像试运行。 And in the test run, I should be able to know the maximum concurrent MySQL connections that the server can handle without crashing or slowing down. 并且在测试运行中,我应该能够知道服务器可以处理的最大并发MySQL连接数,而不会崩溃或变慢。

I tried to understand mysqlslap , but I find it very difficult to understand. 我试图了解mysqlslap ,但是我很难理解。 I have also visited this link , but that is on linux server. 我也访问了此链接 ,但这是在Linux服务器上。 I am working with phpMyAdmin + MySQL. 我正在使用phpMyAdmin + MySQL。 So is there any easy tutorial for phpMyAdmin somewhere? 那么,有什么关于phpMyAdmin的简单教程吗? Or maybe someone can mention what to do shortly. 或者,也许有人可以提一下该怎么办。 Please consider that I am a newbie at this. 请考虑我是这个新手。

You seem to be asking two different kind of questions; 您似乎在问两种不同的问题; what the maximum number of simultaneous mysql connections is and how you can stress-test your server. mysql同时连接的最大数量是多少,以及如何对服务器进行压力测试。

The answer to the first question is easy, there is a mysql setting called max_connections that sets the maximum number of connections and you can check that in phpMyAdmin by going to the Variables tab and searching for max connections . 第一个问题的答案很容易,有一个名为max_connections的mysql设置可以设置最大连接数,您可以通过转到Variables选项卡并搜索max connections来检查phpMyAdmin中的设置。

If you need to change that value you need to look for your config file. 如果需要更改该值,则需要查找配置文件。 That can be for example /etc/my.cnf but that depends on the server and whether you are using MariaDB or MySQL. 例如,可以是/etc/my.cnf但这取决于服务器以及您使用的是MariaDB还是MySQL。

When you stress-test your server, mysql will probably not be the problem, but things like memory, etc. 当您对服务器进行压力测试时,mysql可能不是问题,而是内存等问题。

您可以使用查询使用任何SQL工具检查最大连接数:

SHOW VARIABLES LIKE "max_connections";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM