如何测量MySQL服务器当前的负载?
如何测量MySQL服务器当前的负载?我知道我可以测量不同的东西,例如 CPU 使用率、RAM 使用率、磁盘 IO 等,但是是否有通用的负载测量,例如服务器负载为 40% 等?
How to measure current load of MySQL server? I know I can measure different things like CPU usage, RAM usage, disk IO etc but is there a generic load measure for example the server is at 40% load etc?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
找到此处。
Found here.
“40% 负载”的概念并没有真正明确的定义。您的特定应用程序可能会对不同资源的限制做出不同的反应。应用程序通常会受到以下三个因素之一的限制:可用(物理)内存、可用 CPU 时间和磁盘 IO。
在 Linux(或可能其他 *NIX)系统上,您可以使用 vmstat 或 iostat(提供有关磁盘 IO 的更多详细信息)获取这些快照。
但是,要将这些连接到“40% 负载”,您需要了解数据库在典型负载下的性能特征。做到这一点的最佳方法是在不同的负载量下使用典型查询进行测试,直到您观察到响应时间急剧增加(这意味着您已经遇到了内存、CPU 或磁盘的瓶颈)。该负载应被视为您的临界水平,您不想超过该水平。
The notion of "40% load" is not really well-defined. Your particular application may react differently to constraints on different resources. Applications will typically be bound by one of three factors: available (physical) memory, available CPU time, and disk IO.
On Linux (or possibly other *NIX) systems, you can get a snapshot of these with
vmstat
, oriostat
(which provides more detail on disk IO).However, to connect these to "40% load", you need to understand your database's performance characteristics under typical load. The best way to do this is to test with typical queries under varying amounts of load, until you observe response times increasing dramatically (this will mean you've hit a bottleneck in memory, CPU, or disk). This load should be considered your critical level, which you do not want to exceed.
是否有通用的负载测量,例如服务器负载为 40%?
是的!有:
在Linux机器上工作。它显示过去 1 分钟、5 分钟和 15 分钟的系统负载平均值。
因此,如果你想标准化,你还需要计算 cpu 的数量。
你也可以通过
查看“man proc”来做到这一点
is there a generic load measure for example the server is at 40% load ?
Yes! there is:
Works on a linux machine. It displays the system load averages for the past 1, 5, and 15 minutes.
So if you want to normalize you need to count de number of cpu's also.
you can do that too with
see also 'man proc'
使用 top 或 htop 可以实时跟踪 Linux 中的使用情况
with top or htop you can follow the usage in Linux realtime
在基于 Linux 的系统上,标准检查通常是正常运行时间,根据描述的指标返回负载指数 在这里。
On linux based systems the standard check is usually uptime, a load index is returned according to metrics described here.
除了本页上所有好的答案(SHOW GLOBAL STATUS、VMSTAT、TOP...)之外,还有一个由 Jeremy Zawodny 编写的非常简单易用的工具,它非常适合非管理员用户。它被称为“mytop”。更多信息@ http://jeremy.zawodny.com/mysql/mytop/
aside from all the good answers on this page (SHOW GLOBAL STATUS, VMSTAT, TOP...) there is also a very simple to use tool written by Jeremy Zawodny, it is perfect for non-admin users. It is called "mytop". more info @ http://jeremy.zawodny.com/mysql/mytop/
嗨,朋友,根据我的研究,我们有一些命令,例如
MYTOP
:使用 PERL 语言编写的开源程序MTOP
:也是一个用 PERL 编写的开源程序,它的工作原理与 MYTOP 相同但它会监视花费较长时间的查询并在特定时间后终止它们。上述命令详细信息的链接
Hi friend as per my research we have some command like
MYTOP
: open source program written using PERL languageMTOP
: also an open source program written on PERL, It works same as MYTOP but it monitors the queries which are taking longer time and kills them after specific time.Link for details of above command