gpt4 book ai didi

mysql - 网站用户数少于 50 时,服务器 CPU 达到 100%(Drupal 6)

转载 作者:行者123 更新时间:2023-11-29 07:50:25 24 4
gpt4 key购买 nike

我正在使用的网站遇到问题,该网站是使用 Drupal 6 开发的,并且行为方式很奇怪。

问题是,用户数少于 50 个时,服务器的 CPU 使用率达到 100%(今天发生在 40 个用户的峰值时)。过去情况更糟,服务器崩溃,网站也因此关闭,但现在速度很慢。如果我们有 100 个用户而不是 50 个,也许它会再次崩溃。

这是服务器配置:

CPU
英特尔(R) 酷睿(TM)2 双核 CPU E6550 @ 2.33GHz缓存:4096KB
内存
2x 2048Mo
驱动器:2 x 750 围棋

不知怎的,我觉得这个网站上有 50 个用户就像一个优化良好的网站上有 500 个用户一样。就像 drupal 网站增加了无用查询的数量一样,导致网站变得如此缓慢。尽管网站上的用户数量普遍较低(最大同时连接数:35),但每分钟的请求数为 3300。

我使用了 mysqltuner,这里是带有推荐的文件,可能会有用:

-------- Recommendations ----------------------------------------------------- General recommendations: Run OPTIMIZE TABLE to defragment tables for better performance MySQL started within last 24 hours - recommendations may be inaccurate Enable the slow query log to troubleshoot bad queries Reduce or eliminate persistent connections to reduce connection usage Adjust your join queries to always utilize indexes When making adjustments, make tmp_table_size/max_heap_table_size equal Reduce your SELECT DISTINCT queries without LIMIT clauses Set thread_cache_size to 4 as a starting value Increase table_cache gradually to avoid file descriptor limits Read this before increasing table_cache over 64: http://bit.ly/1mi7c4C

Variables to adjust:

wait_timeout (< 28800)
interactive_timeout (< 28800)
query_cache_size (>= 8M)
join_buffer_size (> 128.0K, or always use indexes with joins)
tmp_table_size (> 32M)
max_heap_table_size (> 16M)
thread_cache_size (start at 4)
table_cache (> )

我知道您可能需要更多信息来找出配置中可能存在的问题。请询问我需要什么,我很乐意编辑我的消息以提供您认为相关的任何信息。

最佳答案

50 个并发用户就足够了。 50/秒意味着每天超过 400 万。

您可以应用大量的性能技巧

  • APC
  • 内存缓存
  • 缓存匿名流量(尝试使用 varnish)
  • 缓存 block 和经过身份验证的用户(在 drupal.org 等上搜索身份验证缓存、 View 缓存的模块和技巧)
  • 数据库改进

还有更多..

关于mysql - 网站用户数少于 50 时,服务器 CPU 达到 100%(Drupal 6),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26584846/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com