{"id":1714,"date":"2005-07-20T10:13:34","date_gmt":"2005-07-20T17:13:34","guid":{"rendered":"http:\/\/www.amptoons.com\/blog\/archives\/2005\/07\/20\/alas-was-offline-for-about-16-hours\/"},"modified":"2005-07-20T10:13:34","modified_gmt":"2005-07-20T17:13:34","slug":"alas-was-offline-for-about-16-hours","status":"publish","type":"post","link":"https:\/\/amptoons.com\/blog\/?p=1714","title":{"rendered":"&quot;Alas&quot; was offline for about 16 hours"},"content":{"rendered":"<p>As many of you noticed, &#8220;Alas&#8221; was offline for about 16 hours, from late yesterday afternoon to early this morning. We&#8217;re back online now, obviously. The rest of this post is a detailed discussion of what went wrong and what I&#8217;m planning to do about it.<\/p>\n<p><!--more--><\/p>\n<p>What happened was a server load problem &#8211; a problem which has plagued this blog. But now I think we finally know what the problem is &#8211; on a blog that gets as many page views as &#8220;Alas&#8221; does, you just can&#8217;t have a 20-post-long &#8220;recently commented&#8221; list. As <a href=\"http:\/\/www.bobhayes.net\/\">Robert <\/a>wrote me via email:<\/p>\n<blockquote><p>Diagnosing your problem:  It&#8217;s your most-recent-comment plugin.<\/p>\n<p>That query is extremely computationally expensive.  (Expense means how much disk and CPU activity it needs in order to run)  You&#8217;re saying &#8220;give me every field in this big honkin, table, and also figure out which record has the latest date, from this huge ass database and with a bunch of logic to process for every row&#8230;oh, and run this on two big-tables in conjunction with each other&#8230;and then when you&#8217;re done with that look at the whole damn result set and put it in order and then subgroup each row by this index field.&#8221;<\/p>\n<p>I&#8217;m tired just reading it; your plugin is probably asking for this every time someone loads any page on your system.  I ran into a similar problem on <a href=\"http:\/\/www.bloggernews.net\/\">BNN<\/a>:  the architecture was very programmatically attractive (this is a nice query) but it didn&#8217;t scale up well.  This query is fantastic for a blog with 2 posts a day and 10 comments apiece but it will put a bullet in the brain of a machine asked to do it 8000 times a day on posts with 300+ comments.  (Particularly because inexpensive web hosting computers tend to be cheap POS rack boxes that don&#8217;t have a ton of hardware because 99% of the sites don&#8217;t need any real processing power to deliver their trickle of hits.)<\/p>\n<p>Easy fix:  kill the plugin.  Hard fix:  Learn or hire WordPress expertise and have someone write you an efficient plugin for big comment sites.<\/p><\/blockquote>\n<p>For now, I&#8217;ve taken Robert&#8217;s &#8220;easy fix,&#8221; because it was the quickest way to get &#8220;Alas&#8221; back online.<\/p>\n<p>Here&#8217;s a letter I sent to DreamHost support, explaining my future plans:<\/p>\n<blockquote><p>Hi! I&#8217;m working on solving my recent server load problems, which led DreamHost Support to turn my WordPress database off yesterday.<\/p>\n<p>The problem was, I believe, caused by my blog&#8217;s &#8220;recently commented posts&#8221; list. A WordPress expert I talked to suggested to me that such a list, when loaded on every single page view on a popular blog, could cause problems if it calls for more than 10 posts to be listed. My &#8220;recently commented posts&#8221; list was set to list the 20 posts that comments had recently been left on.<\/p>\n<p>Because my blog emphasizes reader comments and discussion (the blog sometimes get hundreds of reader comments a day), the &#8220;recently commented posts&#8221; list is essential &#8211; without it, posts that still have active discussions will &#8220;fall off&#8221; the front page and be too hard for readers to find. What I&#8217;d like to do is experiment a little, to find a way to restore the &#8220;recently commented posts&#8221; list that won&#8217;t cause an unfair strain on DreamHost&#8217;s server load.<\/p>\n<p>My proposal is to restore the &#8220;recently commented posts&#8221; list on the sidebar &#8211; but this time with only 7 posts listed, rather than 20. That should reduce the server load enormously, hopefully eliminating the problem. I&#8217;ll also create a separate page with a larger, more detailed listing &#8211; but since it&#8217;s a separate page, I expect it&#8217;ll only be loaded by the relatively small number of very dedicated readers who follow the discussions very closely.<\/p>\n<p>What I&#8217;d like is your help in making it possible for me to run this experiment. I could start this at any time that works for you (I suggest 9am pacific time Thursday). What I&#8217;d like from DreamHost Support is, if the server load gets too high (and I don&#8217;t think it will), rather than shutting me off, email me letting me know there&#8217;s a problem. I&#8217;ll make sure to monitor my email frequently. Once emailed, I&#8217;ll turn the offending plugin off immediately and use the new information to figure out the next step.<\/p>\n<p>This will allow me to try to find a solution without fear of having my blog suddenly turned off by the host; and it will provide you with assurance that if there is a server load issue caused by the plugin, it will be turned off quickly.<\/p>\n<p>The other thing I&#8217;d like, if things go wrong and I have to shut the plugin off, is a detailed report from the database regarding server load. This will help my consulting expert figure out what is wrong and how to run my blog while avoiding the problem in the future.<\/p>\n<p>I hope that we can work together to let my blog have the functionality it needs, without causing server load problems. I&#8217;ll look forward to your response.<\/p><\/blockquote>\n<p>So that&#8217;s the plan; I should hear back from DreamHost Support by sometime tomorrow. Let me know what y&#8217;all think.<\/p>\n<p>On another subject, I have no idea why the comment preview stopped working once I&#8217;d moved to DreamHost. If anyone has a clue, please enlighten me. :-)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As many of you noticed, &#8220;Alas&#8221; was offline for about 16 hours, from late yesterday afternoon to early this morning. We&#8217;re back online now, obviously. The rest of this post is a detailed discussion of what went wrong and what &hellip; <a href=\"https:\/\/amptoons.com\/blog\/?p=1714\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[98],"tags":[],"class_list":["post-1714","post","type-post","status-publish","format-standard","hentry","category-site-and-admin-stuff"],"_links":{"self":[{"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1714","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1714"}],"version-history":[{"count":0,"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1714\/revisions"}],"wp:attachment":[{"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1714"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}