{"id":333,"date":"2009-03-15T13:49:28","date_gmt":"2009-03-15T10:49:28","guid":{"rendered":"http:\/\/www.void.gr\/kargig\/blog\/?p=333"},"modified":"2009-05-03T13:13:59","modified_gmt":"2009-05-03T10:13:59","slug":"how-much-can-misconfigured-wordpress-plugins-stall-your-servers-performance","status":"publish","type":"post","link":"https:\/\/www.void.gr\/kargig\/blog\/2009\/03\/15\/how-much-can-misconfigured-wordpress-plugins-stall-your-servers-performance\/","title":{"rendered":"How much can misconfigured wordpress plugins stall your server&#8217;s performance"},"content":{"rendered":"<p>A couple of days ago I&#8217;ve met a guy who has a high traffic blog about tech stuff. The guy was telling me that he has hosting problems and that his blog is getting slower and slower by the day. I&#8217;ve offered to help him by providing hosting for him in one of the servers that I administer. After making the transition from his old hosting to my server, which was not an easy thing to do due to latin1 to utf8 conversions that had to be made &#8211; it deserves a post of it&#8217;s own, I started to notice increased load on my server. Sure his blog had heavy traffic&#8230;but could it be that bad ?<br \/>\n<!--more--><br \/>\nThe first thing I noticed was that the disk usage was raising FAST.<br \/>\n<a href=\"http:\/\/www.void.gr\/kargig\/blog\/wp-content\/server-df-day.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.void.gr\/kargig\/blog\/wp-content\/server-df-day.png\" alt=\"server-df-day\" title=\"server-df-day\" width=\"495\" height=\"312\" class=\"alignnone size-full wp-image-338\" srcset=\"https:\/\/www.void.gr\/kargig\/blog\/wp-content\/server-df-day.png 495w, https:\/\/www.void.gr\/kargig\/blog\/wp-content\/server-df-day-300x189.png 300w\" sizes=\"auto, (max-width: 495px) 100vw, 495px\" \/><\/a><\/p>\n<p>Since there was no heavy network traffic the data must have been created internally by the server. I started checking on the \/var\/log\/ directory.<br \/>\n<code># du -sh \/var\/log\/<br \/>\n4.6G    \/var\/log\/<\/code><br \/>\nThat needed further investigation for sure!<br \/>\n<code># du --max-depth=1 -h \/var\/log\/<br \/>\n[..snip..]<br \/>\n8.0K    \/var\/log\/postgresql<br \/>\n4.6G    \/var\/log\/mysql<br \/>\n12K     \/var\/log\/fsck<br \/>\n[..snip..]<br \/>\n4.6G    \/var\/log\/<\/code><br \/>\nOK&#8230;the culprit was mysql for a reason. The directory mostly contained mysql binary logs.<br \/>\n<code># ls -Fla \/var\/log\/mysql\/ |  grep mysql-bin | wc -l<br \/>\n58<br \/>\n# ls -Fla \/var\/log\/mysql\/ |  grep mysql-bin | grep 03-14| wc -l<br \/>\n46<br \/>\n<\/code><br \/>\nOut of the 58 binlogs, 46 were produced on the day of the transition. While the previous dates had binlogs of around 30-40Mb, the day of the transition had 46 binlogs of around 100Mb each! That&#8217;s 4.6Gb vs 40Mb for just one day!<br \/>\nI&#8217;ve opened up a few of those using mysql: <code># mysql -u root -p<br \/>\nSHOW BINLOG EVENTS IN 'mysql-bin.000337';<br \/>\n<\/code><br \/>\nThe binlogs were full of some wordpress queries by the newly installed blog.<\/p>\n<p>I then asked for a wordpress admin account on the blog to check on the plugins. I found a lot of plugins installed. Two of those were <a href=\"http:\/\/mnm.uib.es\/gallir\/wp-cache-2\/\">WP-Cache<\/a> and <a href=\"http:\/\/wordpress.net.ua\/db-cache\">DB-Cache<\/a>.<br \/>\nI started checking on WP-Cache. When I went to Settings->WP-Cache, it complained that it was misconfigured. It couldn&#8217;t create the cache files due to wrong permissions on some directories. So I changed the proper permissions and I could immediately see a difference on server load and on blog loading time. The blog took over 2.5 seconds to load when WP-Cache was misconfigured but it could now load in under 2 seconds. Still the mysql binlogs continued to increase in size very very fast.<br \/>\nDB-Cache on the other hand did not complain about anything when I went to Settings->DB-Cache. Only when I tried changing some settings it notified me that there was again a permissions&#8217; problem. Fixing that started showing again some results. Blog&#8217;s load time fell down to 1.5-1.7 seconds. There were also less queries on the binlogs but still there were many. Many of those looked like:<br \/>\n<code>UPDATE wp_options SET option_value = 'O:8:\\\"stdClass\\\":3:{s:7:\\\"updates\\\";a:1:{<br \/>\ni:0;O:8:\\\"stdClass\\\":5:{s:8:\\\"response\\\";s:7:\\\"upgrade\\\";s:3:\\\"url\\\";s:30:\\\"http:\/\/wordpress.org\/download\/\\\";s:7:\\\"package\\\";s:40:\\\"<br \/>\nhttp:\/\/wordpress.org\/wordpress-2.7.1.zip\\\";s:7:\\\"current\\\";s:5:\\\"2.7.1\\\";s:6:\\\"locale\\\";s:5:\\\"en_US\\\";}}s:12:\\\"last_checked\\\";i:1237<br \/>\n062227;s:15:\\\"version_checked\\\";s:3:\\\"abc\\\";}' WHERE option_name = 'update_core'<\/code><br \/>\nI have no idea why wordpress with db-cache keeps doing those queries when DB-cache is enabled.<\/p>\n<p>Anyway, I disabled DB-Cache so the blog could only rely on my own cache settings for mysqld. The results were magnificent. Blog load time reduced to 1.0-1.2 seconds!! Mysql got a boost on cached queries and server load avg is also very low again.<\/p>\n<p><a href=\"http:\/\/www.void.gr\/kargig\/blog\/wp-content\/server-mysql_queries-day.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.void.gr\/kargig\/blog\/wp-content\/server-mysql_queries-day.png\" alt=\"server-mysql_queries-day\" title=\"server-mysql_queries-day\" width=\"495\" height=\"336\" class=\"alignnone size-full wp-image-342\" srcset=\"https:\/\/www.void.gr\/kargig\/blog\/wp-content\/server-mysql_queries-day.png 495w, https:\/\/www.void.gr\/kargig\/blog\/wp-content\/server-mysql_queries-day-300x203.png 300w\" sizes=\"auto, (max-width: 495px) 100vw, 495px\" \/><\/a><br \/>\n(ignore the spike at the end and notice the difference that happens sometime around saturday evening when the cached hits, purple, surpass the select, green)<\/p>\n<p><a href=\"http:\/\/www.void.gr\/kargig\/blog\/wp-content\/server-load-day.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.void.gr\/kargig\/blog\/wp-content\/server-load-day.png\" alt=\"server-load-day\" title=\"server-load-day\" width=\"495\" height=\"264\" class=\"alignnone size-full wp-image-340\" srcset=\"https:\/\/www.void.gr\/kargig\/blog\/wp-content\/server-load-day.png 495w, https:\/\/www.void.gr\/kargig\/blog\/wp-content\/server-load-day-300x160.png 300w\" sizes=\"auto, (max-width: 495px) 100vw, 495px\" \/><\/a><\/p>\n<p>Everybody is happy, client has a fast blog and I&#8217;ve got a very responsive and fast server \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A couple of days ago I&#8217;ve met a guy who has a high traffic blog about tech stuff. The guy was telling me that he has hosting problems and that his blog is getting slower and slower by the day. I&#8217;ve offered to help him by providing hosting for him in one of the servers [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ep_exclude_from_search":false,"footnotes":""},"categories":[3],"tags":[20,17,595,19,16,18],"class_list":["post-333","post","type-post","status-publish","format-standard","hentry","category-linux","tag-caching","tag-db-cache","tag-linux","tag-mysql","tag-wordpress","tag-wp-cache"],"aioseo_notices":[],"views":20976,"_links":{"self":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts\/333","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/comments?post=333"}],"version-history":[{"count":11,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts\/333\/revisions"}],"predecessor-version":[{"id":490,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts\/333\/revisions\/490"}],"wp:attachment":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/media?parent=333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/categories?post=333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/tags?post=333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}