简体   繁体   English

Joomla数据库内存泄漏

[英]Joomla database memory leak

My client has got a pretty large Joomla-based website hosted on Amazon EC2 with 1.5GB of RAM. 我的客户在Amazon EC2上托管了一个基于Joomla的大型网站,具有1.5GB的内存。 The server hosts both Apache and MySQL. 该服务器同时托管Apache和MySQL。 Right now the database size is around 250MB and the website gets daily traffic of about 5000. It looks like there is a severe memory leak on the website as sometimes MySQL uses about 99% of CPU memory and then crashes. 现在,数据库大小约为250MB,网站每天的访问量约为5000。看起来网站上存在严重的内存泄漏,因为有时MySQL使用约99%的CPU内存,然后崩溃。 I have tried optimizing database tables, modifying my .cnf , but still there is no improvement. 我曾尝试优化数据库表,修改.cnf ,但仍然没有任何改善。

There are finder tables used by Joomla smart search which occupy over 100MB of db size. Joomla智能搜索使用的查找程序表占用了100MB以上的数据库大小。 I have disabled smart search, but still the problem occurs. 我已禁用智能搜索,但是仍然出现问题。

Friends, please throw some suggestions in fixing this. 朋友,请提出一些建议解决此问题。

Thanks. 谢谢。

Below is the my.cnf file 以下是my.cnf文件

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

symbolic-links=0
bind-address            = 127.0.0.1

default-storage-engine=innodb
transaction-isolation    =   REPEATABLE-READ
character-set-server    =   UTF8
collation-server      =   UTF8_general_ci

max_connections         = 5000
wait_timeout            = 30
connect_timeout         = 60
#interactive_timeout     = 600
#max_connect_errors      = 1000000
#max_allowed_packet      = 10M


skip-external-locking
key_buffer_size = 384M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8

slow_query_log
long_query_time = 2

[mysqld_safe]
log-error=/var/log/mysqld.log
myisam_sort_buffer_size = 64M

My bet would be that you are being hit by a rogue robot - one of the many SEO spiders out there, or tools like 80legs that let people program a network of bots to carry out tasks - often with errors in their programming that result in a heavy bombardment. 我敢打赌,您会受到流氓机器人的攻击-那里的许多SEO蜘蛛之一,或者诸如80legs之类的工具,这些工具使人们对机器人网络进行编程以执行任务-时常在编程错误中导致重炮轰。

I can never remember which of the MySQL settings take memory once and which are per connection - but as you are set to allow up to 5000 simultaneous connections and some of the buffers are 2 and 8 MB I'd bet that the total memory usage under heavy load could easily be in excess of the total ram available. 我永远不记得哪个MySQL设置一次占用内存,每个连接哪个内存-但是由于您设置为最多允许5000个同时连接,并且某些缓冲区为2和8 MB,所以我敢打赌,重载很容易超过可用的总闸板。

Your current settings would allow all of your daily traffic to hit simultaneously. 您当前的设置将使您的所有日常流量同时达到目标。 I'd knock that down to a setting of a hundred or less and see if that gives more stability. 我会将其降低到100或更少的设置,看看是否可以提供更大的稳定性。

There are various MySQL tuner scripts out there that can help you spot where too much memory is allocated. 那里有各种MySQL调谐器脚本,可以帮助您发现分配过多内存的位置。

If you have access logs from around the time of the crashes / high load I'd check for malicious bots though - we've had a constant battle to reign them in on some sites we monitor/control. 但是,如果您在崩溃/高负载期间有访问日志,尽管如此,我还是会检查恶意机器人-我们一直在不断努力争取在我们监控/控制的某些网站上使用它们。

You might also check the thread_concurrency value - depending upon how many CPUs you have available. 您可能还会检查thread_concurrency值-取决于可用的CPU数量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM