问题描述
我正在为共享托管所需的MySQL和资源设置理想的性能设置。
I'm trying to set the ideal performance setup for MySQL and resources needed on a shared hosting.
我的问题是, max_connections
是什么意思?
My question is, what does max_connections
really mean?
是否向服务器发出唯一的并发请求数?
所以如果有两个用户,1个打开1个选项卡,另一个打开4个选项卡,并且同时按下所有的选项卡重新加载,将有5个连接到MySQL数据库?因此,如果我们遇到这种情况:10个人有2个标签,31个人有一个选项卡,同时按下刷新...与我们的 max_connections
在50,将每个人都被锁定?
Is it the number of unique concurrent requests made to the server?So if there are two users, 1 with 1 tab open and the other with 4 tabs open... and both press all their tabs to reload at the same time, will there be 5 connections made to the MySQL DB? Consequently, if we bump this scenario to: 10 people with 2 tabs and 31 people with one tab all pressing refresh at the same time... with our max_connections
at 50, will everyone get locked out?
我问的原因是因为我想要拍摄低 max_connections
来保守记忆资源,因为我一直看到网站进入cpu节流模式
The reason I ask is because I want to shoot for low max_connections
to be conservative with memory resources since I consistently see the site going into cpu throttling mode
谢谢你的帮助
推荐答案
是的,每页打开一个单独的连接。但是,假设您没有做任何数据库密集型操作,连接将会很短暂,并且一旦页面被提供给客户端就会关闭。
Yes, there is a separate connection opened for each page. However, assuming you're not doing anything database-intensive, the connection will be short-lived and close itself once the page has been served to the client.
如果你超过最大连接数,任何后续连接尝试都将失败。
If you do exceed the maximum number of connections, any subsequent connection attempt will fail.
这篇关于max_connections是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!