如何设置 MySQL 进程或线程的最大数量?
ps axuw| grep mysql
仅指示 MySQL 进程,但如果我运行 htop,我可以看到 10 行,每一行都有一个单独的 PID。 所以我想知道它们是否是由于某种原因我无法使用 ps 看到的线程或进程。
在我的开发机器上尝试将它们限制为两个是否有意义,因为我不需要许多客户端的并发访问。
顺便说一句,在 Ubuntu 8.10 上运行
ps axuw| grep mysql
indicates only MySQL process, but if I run htop I can see 10 rows each one of them with a separate PID. So I wonder if they are threads or processes that for some reason I cannot see using ps.
Would it make any sense to try to limit them to two on my development machine, where I don't need concurrent access of many clients.
BTW Running on Ubuntu 8.10
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以在 my.ini 中设置最大线程数,如下所示:
但是您可能还想设置以下内容:
线程缓存控制即使没有发生任何事情也保持打开状态的数量。
You can set the max number of threads in your my.ini like this:
However you might also want to set this:
The thread cache controls how many it keeps open even when nothing is happening.
MySQL 确实使用线程,如果运行
ps -eLf
,ps
可以看到它们。也就是说,我不会担心它 - 休眠线程几乎不使用任何资源,如果你对服务器限制太多,当你忘记你做了这件事时,它一定会回来咬你的后背。
MySQL does use threads,
ps
can see them if you runps -eLf
.That said, I wouldn't worry about it - dormant threads use almost no resources whatsoever, and if you constrain the server too much it's bound to come back and bite you on the backside sometime later when you've forgotten that you did it.
/etc/mysql/my.cnf
中很少有配置设置会影响内存使用。以下设置应该会大大减少 mysql 的内存使用量:
您可以在此处了解更多信息:http://opensourcehacker.com/2011/03/31/reducing-mysql-memory-usage-on-ubuntu-debian-linux/
There is few configuration settings in
/etc/mysql/my.cnf
that would impact memory usage.The following settings should drastically reduce the memory usage of mysql:
You can learn more here: http://opensourcehacker.com/2011/03/31/reducing-mysql-memory-usage-on-ubuntu-debian-linux/
我正在寻找 MySQL 配置的东西,然后我看到了这个问题...与 MySQL 无关,对吗?
如果主要目标是查看自定义命令的结果,您可以使用“watch”,语法如下(大多数 Linux 系统上可用):
它将每 2 秒运行一次命令并显示输出,这是一个非常非常好的命令。有用的命令。
-> 请参阅 doc/man 以了解它的强大功能;)
I was seeking for MySQL config stuff, then I saw this question.... Nothing to do with MySQL, am I right ?
If the main objective is to see the result of a custom command, you can use "watch" with the following syntax (available on most linux systems) :
It will run the command each 2 seconds and display the output, it is a very very useful command.
-> See the doc/man to see how it's powerful ;)