max_connections 的真正含义是什么?

2024-04-15数据库问题
4

本文介绍了max_connections 的真正含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在尝试为 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 个选项卡……并且同时按下所有选项卡重新加载,是否会与 MySQL 数据库建立 5 个连接?因此,如果我们将这种情况变成: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 的真正含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

Mysql目录里的ibtmp1文件过大造成磁盘占满的解决办法
ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致...
2025-01-02 数据库问题
151

SQL 子句“GROUP BY 1"是什么意思?意思是?
What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)...
2024-04-16 数据库问题
62

MySQL groupwise MAX() 返回意外结果
MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)...
2024-04-16 数据库问题
13

MySQL SELECT 按组最频繁
MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)...
2024-04-16 数据库问题
16

为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同
Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)...
2024-04-16 数据库问题
13

MySQL GROUP BY DateTime +/- 3 秒
MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)...
2024-04-16 数据库问题
14