我做了顶部并得到:
Tasks: 590 total, 8 running, 582 sleping, 0 stopped, 0 zombie
Cpus(s) 96.5%us, 2.7%sy, 0.0%ni, 0.4%id, 0.0%wa, 0.0%hi, 0.4%si, 0.0%st
Mem: 32877280k total, 30611188k used, 2266092k free, 4021204k buffers
Swap 0k total, 0k used, 0k free, 4267024k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
21672 mysql 20 0 13.1G 8.9G 8496 S 559.1 28.3 124168:04 mysqld
12025 webs 20 0 494m 59m 5544 S 30.8 02 1:09.82 php-fpm
13325 webs 20 0 414m 57m 8014 S 21.4 02 1:08.42 php
11111 webs 20 0 495m 64m 3231 S 18.5 02 1:12.16 php-fpm
13232 webs 20 0 505m 96m 8542 S 16.5 02 1:12.12 php-fpm
13217 webs 20 0 401m 52m 8541 S 15.5 02 1:02.44 php-fpm
13119 webs 20 0 475m 39m 8555 S 15.5 02 1:02.16 php-fpm
12065 webs 20 0 495m 49m 2533 S 14.9 02 1:22.41 php-fpm
12161 webs 20 0 412m 61m 2524 S 10.5 02 1:06.01 php-fpm
12275 webs 20 0 455m 51m 1544 S 10.5 02 1:34.04 php-fpm
12427 webs 20 0 464m 92m 7541 S 10.5 02 1:31.41 php-fpm
12127 webs 20 0 459m 89m 6544 S 10.5 02 1:01.19 php-fpm
现在,我在思考,我认为让服务器更快的最佳方法是重新启动 mysqld 进程,但我如何确保没有发生大型 sql 转储?我确实显示了完整的进程列表,但我被告知它不会告诉您是否有正在进行的转储,因为插入发生得非常快。此外,我如何进一步调查?在我读过的一篇文章中,我被告知如果 id 和 wa 较低,我需要检查 CPU 是否较高,如果 CPU 较高,我需要重新启动该进程。我应该多久重新启动一次,当服务器速度变慢时,决策树是什么,我需要做哪些事情?
我确实显示了完整的进程列表并得到:
1 system user Daemon InnoDB purge coordinator
4 system user Daemon InnoDB purge worker
3 system user Daemon InnoDB purge worker
2 system user Daemon InnoDB purge worker
5 system user Daemon InnoDB shutdown handler
109725 root localhost:54620 Query 0 Init show full processlist
142438 cakes localhost cakes Sleep 295
142449 cakes localhost cakes Sleep 21
144422 pancakes localhost pancakes Sleep 54
144426 pancakes localhost:54038 pancakes Sleep 56
145072 bookletv3 localhost bookletv3 Query 0 Sending data SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) INNER JOIN wp_prod wc ON wc.post_id = wp_posts.ID AND (0 or 1) AND (wc.stock = 'm004189' OR wc.vin = 'm004189') AND ( wc.isbudget IS NULL OR wc.isbudget <> 1 ) AND ( wc.deleted IS NULL OR wc.deleted <> 1 ) WHERE 1=1 AND (
wp_postmeta.meta_key = '_prod_info_new'
) AND wp_posts.post_type = 'used-prod' AND (wp_posts.post_status = 'publish') GROUP BY wp_posts.ID ORDER BY wc.SoldDate IS NULL, wc.SoldDate ASC, wc.isnew DESC LIMIT 0, 15
145073 bookletv3 localhost:33840 bookletv3 Sleep 0
145074 bookletv3 localhost bookletv3 Query 0 Statistics -- (brand) product city
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
INNER JOIN `wp_prod` c
ON (
(c.bestproductname = s.product and c.bestproductname != '')
OR c.product = s.product
)
WHERE c.product != '' AND c.product = 'tiramisu' AND s.`city` = 'losangeles' AND s.`prod_type` = 1 AND s.text_es <>''
AND c.location in ("HY2112","HY1134","HY90428","HY10223","AR13821","AR90498","AR90613","BR92144","BR9239")
LIMIT 1)
-- brand city
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
WHERE s.brand = 'Chewy' AND s.brand != '' AND s.`city` = 'losangeles' AND s.`city` != '' AND s.`prod_type` = 1 AND s.text_es <>'')
-- city
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_city_seo` s
WHERE `city_slug` = 'losangeles' AND `city_slug` != ''
LIMIT 1)
-- product
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
INNER JOIN `wp_prod` c
ON (
(c.bestproductname = s.product and c.bestproductname != '')
OR c.product = s.product
)
WHERE c.product = 'tiramisu' AND c.product != '' AND s.`prod_type` = 1 AND s.text_es <>''
AND c.location in ("HY2112","HY1134","HY90428","HY10223","AR13821","AR90498","AR90613","BR92144","BR9239")
LIMIT 1)
-- brand
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
WHERE (s.brand = 'Chew' OR s.brand = '') AND s.brand != '' AND s.`prod_type` = 1 AND s.text_es <>''
LIMIT 1)
-- none
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
WHERE s.brand = '' AND s.product = '' AND s.`prod_type` = 1 AND s.text_es <>'')
LIMIT 1
145075 bookletv3 localhost bookletv3 Sleep 0
145076 bookletv3 localhost bookletv3 Sleep 0
145077 bookletv3 localhost:33858 bookletv3 Sleep 0
145078 bookletv3 localhost:33860 bookletv3 Sleep 0
145079 bookletv3 localhost:33862 bookletv3 Sleep 0
145080 bookletv3 localhost bookletv3 Query 0 Statistics -- (brand) product city
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
INNER JOIN `wp_prod` c
ON (
(c.bestproductname = s.product and c.bestproductname != '')
OR c.product = s.product
)
WHERE c.product != '' AND c.product = 'muffins' AND s.`city` = 'losangeles' AND s.`prod_type` = 1 AND s.text_es <>''
AND c.location in ("HY2112","HY1134","HY90428","HY10223")
LIMIT 1)
-- brand city
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
WHERE s.brand = 'Chewy' AND s.brand != '' AND s.`city` = 'losangeles' AND s.`city` != '' AND s.`prod_type` = 1 AND s.text_es <>'')
-- city
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_city_seo` s
WHERE `city_slug` = 'losangeles' AND `city_slug` != ''
LIMIT 1)
-- product
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
INNER JOIN `wp_prod` c
ON (
(c.bestproductname = s.product and c.bestproductname != '')
OR c.product = s.product
)
WHERE c.product = 'muffin' AND c.product != '' AND s.`prod_type` = 1 AND s.text_es <>''
AND c.location in ("HY2112","HY1134","HY90428","HY10223","AR13821","AR90498","AR90613","BR92144","BR9239")
LIMIT 1)
-- brand
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
WHERE (s.brand = 'Chewy' OR s.brand = '') AND s.brand != '' AND s.`prod_type` = 1 AND s.text_es <>''
LIMIT 1)
-- none
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
WHERE s.brand = '' AND s.product = '' AND s.`prod_type` = 1 AND s.text_es <>'')
LIMIT 1
145081 bookletv3 localhost bookletv3 Query 0 Statistics -- (brand) product city
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
INNER JOIN `wp_prod` c
ON (
(c.bestproductname = s.product and c.bestproductname != '')
OR c.product = s.product
)
WHERE c.product != '' AND c.product = 'muffins' AND s.`city` = 'losangeles' AND s.`prod_type` = 1 AND s.text_es <>''
AND c.location in ("HY2112","HY10223")
LIMIT 1)
-- brand city
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
WHERE s.brand = 'Chewy' AND s.brand != '' AND s.`city` = 'losangeles' AND s.`city` != '' AND s.`prod_type` = 1 AND s.text_es <>'')
-- city
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_city_seo` s
WHERE `city_slug` = 'losangeles' AND `city_slug` != ''
LIMIT 1)
-- product
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
INNER JOIN `wp_prod` c
ON (
(c.bestproductname = s.product and c.bestproductname != '')
OR c.product = s.product
)
WHERE c.product = 'muffin' AND c.product != '' AND s.`prod_type` = 1 AND s.text_es <>''
AND c.location in ("HY2112","HY1134")
LIMIT 1)
-- brand
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
WHERE (s.brand = 'Chewy' OR s.brand = '') AND s.brand != '' AND s.`prod_type` = 1 AND s.text_es <>''
LIMIT 1)
-- none
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
WHERE s.brand = '' AND s.product = '' AND s.`prod_type` = 1 AND s.text_es <>'')
LIMIT 1
145082 bookletv3 localhost bookletv3 Query 0 Statistics -- (brand) product city
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
INNER JOIN `wp_prod` c
ON (
(c.bestproductname = s.product and c.bestproductname != '')
OR c.product = s.product
)
WHERE c.product != '' AND c.product = 'tiramisu' AND s.`city` = 'losangeles' AND s.`prod_type` = 1 AND s.text_es <>''
AND c.location in ("BR92144","BR9239")
LIMIT 1)
-- brand city
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
WHERE s.brand = 'Chewy' AND s.brand != '' AND s.`city` = 'losangeles' AND s.`city` != '' AND s.`prod_type` = 1 AND s.text_es <>'')
-- city
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_city_seo` s
WHERE `city_slug` = 'losangeles' AND `city_slug` != ''
LIMIT 1)
-- product
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
INNER JOIN `wp_prod` c
ON (
(c.bestproductname = s.product and c.bestproductname != '')
OR c.product = s.product
)
WHERE c.product = 'tiramisu' AND c.product != '' AND s.`prod_type` = 1 AND s.text_es <>''
AND c.location in ("BR92144","BR9239")
LIMIT 1)
-- brand
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
WHERE (s.brand = 'Chew' OR s.brand = '') AND s.brand != '' AND s.`prod_type` = 1 AND s.text_es <>''
LIMIT 1)
-- none
UNION ALL
(SELECT s.text_es text
FROM `wp_prod_brandproduct_seo` s
WHERE s.brand = '' AND s.product = '' AND s.`prod_type` = 1 AND s.text_es <>'')
LIMIT 1
有这方面的教程吗?我很害怕,因为我不确定该怎么做。