How To Improve Performance of Highly Commented WordPress Blogs如何提高的表現,高度評價WordPress Blogs的
Most of highly trafficked and highly commented wordpress blogs rely upon some smart caching solution or another.大部分被販賣的高度和高度評價WordPress Blogs的依靠一些智能緩存解決方案,或其他。 However it may not be enough to prevent slowing down your server if your post(s) are heavily commented upon.但它可能沒有足夠的,以防止放緩,您的服務器,如果您的帖子( S )的大量評論。 This is because smart caching solutions re-create the cache whenever a new comment is posted.這是因為智能緩存解決方案,重新建立緩存每當一個新的評論是張貼。 Here is a simple solution in three steps.這裡是一個簡單的解決方案在三個步驟。
Steps:步驟:
- Install (and activate)安裝(並激活) Wp-Cache 2可濕性粉劑緩存2 plugin.插件。 I have excellent experience with it for over a year.我有很好的經驗,與它超過一年。
- Modify wp-cache-phase2.php (one of the plugin files) to comment / delete the line:修改可濕性粉劑-緩存phase2.php (其中的插件文件)評論/刪除行:
add_action('comment_post', 'wp_cache_get_postid_from_comment', 0);add_action ( ' comment_post ' , ' wp_cache_get_postid_from_comment ' , 0 ) ; - Set the cache expiration time to 2 hours or more.設置緩存到期時間為2小時或以上。 This can easily handle a slashdot effect without breaking a sweat.這可以輕鬆地處理Slashdot的效果打破了汗水。
The change in step 2 ensures that the pages are not regenerated everytime a new comment is posted.變化在第2步確保該網頁不會再生,每次一個新的評論是張貼。 They are however regenerated after the expiration of cache.他們是再生,但到期後緩存。 This time lag saves an enormous amount of sql query when a post is heavily commented.這個時間差可以節省大量的SQL查詢時,後是大量的評論。
Filed under提起下 CMS Software CMS軟件 , , Headline News頭條新聞 , , How To如何 , , PHP PHP的 , , Pro Blogging贊成Blogging , , Tech Note技術說明 , , Web網頁 , , Web Services Web服務 , , WordPress在WordPress | |
| |
RSS 2.0 2.0 | |
Trackback Trackback跟踪 this Article |此文章|
Email this Article電子郵件此文章
You may also like to read您也可以想讀 |




April 27th, 2006 at 10:49 am 2006年4月27日在上午10時49分
People like instant gratification.人喜歡即時欣慰。 If somebody makes a comment on a website, they expect it to show up immediately.如果有人作出了評論一個網站上,他們期望它立即顯示。 Otherwise, the commentor will be discouraged from posting a comment in the future.否則, commentor將勸阻張貼評論在未來的。
Because of this, I think that another solution is needed.正因為如此,我認為另一種解決辦法是必要的。
April 27th, 2006 at 12:51 pm 2006年4月27日在下午12時51分
When the choice is between providing instant gratification versus making the site available, isn’t the solution clear?當選擇是之間提供即時欣慰的銀兩,使該網站提供的,是並非解決問題的方法清楚?
I don’t think expecting comments to appear immediately is something which users have come to expect as many sites today have manual or semi-manual moderation policy.我不認為預期的意見立即出現,是一些用戶來期望作為許多網站今天有手動或半手動溫和的政策。 A clear statement explaining the situation should address the expectations.一個明確的說明,解釋的情況,應解決的期望。
April 27th, 2006 at 10:53 pm 2006年4月27日在下午10時53分
Have you implemented this on a public site that I can see it in action on?你實施這在一個公開的網站,我可以看到它在行動上呢? I noticed when I posted that you don’t use it on this one.我注意到,當我張貼您不要使用它在此一。 I am really curious about the type of site you feel this would be helpful on.我真的很好奇的網站類型,你覺得這會有幫助。
My feeling is that the number of comments on a weblog is going to be very low.我的感覺是,評論數對網絡博客將會非常低。 But, even if somehow the volume of comments becomes a problem, wouldn’ta better solution be to move the comments onto a seperate page?但是,即使有點貨量評論成為一個問題, wouldn'ta更好的解決辦法,被提出的意見,到一個單獨的網頁? This would get rid of most of the read-only load as well as the read-write load due to comments because you are only sending that page to the small fraction of people that care about the comments in the first place.這將擺脫大部分的唯讀負荷以及讀寫負荷,由於評論,因為你是唯一發送該網頁向小部分人認為,關心評論擺在首位。
Anyway, I just think that there are so many other possibilities to improve performance before taking a step that has such a negative impact on the user experience.無論如何,我只是覺得有這麼許多其他的可能性,以提高性能,然後才採取的一個步驟有這樣的負面影響用戶體驗。
April 28th, 2006 at 12:17 pm 2006年4月28日在下午12時17分
> My feeling is that the number of comments on a weblog is going to be very low. >我的感覺是,評論數對網絡博客將會非常低。
Again this is not a solution for oridinary situations.再次,這是不是一個解決辦法,為oridinary情況。 There are certain popular blogs which elicit lots of comments, especially more when you break a story / get slashdotted etc. usmagazine is one such site.有某些較受歡迎的博客,這引起了很多的意見,尤其是當您更打破了一個故事/得到slashdotted等usmagazine就是這樣一個網站。
I used this technique for a limited time on this blog with good results.我用這一技術為在有限的時間內就這一博客了良好效果。
> But, even if somehow the volume of comments becomes a problem, wouldn’ta better solution be to move the comments onto a seperate page? >但是,即使有點貨量評論成為一個問題, wouldnâ € ™電訊管理局局長更好的解決辦法,被提出的意見,到一個單獨的網頁?
How are you going to do that within WordPress framework?你將如何做,那就是在WordPress的框架呢?
> Anyway, I just think that there are so many other possibilities to improve performance >無論如何,我只是覺得有這麼許多其他的可能性,以提高性能
Please let me know how you plan to optimize performance of a heavily commented site without slowing down page re-generation after comments?請讓我知道您打算如何優化性能的大量評論的網站沒有放緩頁重新一代又有何意見?
April 28th, 2006 at 2:36 pm 2006年4月28日在下午2時36分
Sorry to be a little dense, but does this hack actually make the comments not appear on individual post pages until the cache expires?遺憾的是一個小密,但這個技巧,其實作出的評論,就不會出現在個別後的頁面,直到緩存過期? Or do the number of comments indicated on the main page simply not update to match the actual number of comments visible on individual comment pages?或做一些評論表示,在主網頁根本沒有更新,以符合實際人數有形的評論對個別評論的頁面?
jf櫻美林
April 28th, 2006 at 9:23 pm 2006年4月28日在下午9點23分
The new comments are published as soon as the cache expires.新的註釋是盡快公佈緩存有效期屆滿為止。 So if your cache is set to 30 minutes then you get to see the new comments every 30 minutes instead of instantly.因此,如果您的緩存設置為30分鐘,然後您能看到新的評論,每30分鐘一班,而不是立即。
Probably this is what was not clear to Brian as I am still trying to understand why he thinks it would be such a bad thing.也許,這是什麼並不清楚布賴恩,因為我仍試圖明白他為什麼認為它會這樣的一件壞事。
April 29th, 2006 at 7:27 am 2006年4月29日在上午07時27分
It’s not a terrible thing, but it’s not right for every site.它不是一個可怕的事情,但它的不正確的每一個網站。 For sites where the community and discussion aspect is an important part of why people visit, changing the situation from comments-appear-instantly to comments-appear-after-a-pause can turn people off and eliminate one of the reasons that they came and visited in the first place.網站的社區和討論方面的一個重要組成部分,為什麼人訪問,改變的情況,從評論-出現-即時評論-出現-後-一-暫停可以把人民的小康和消除的原因之一,他們來和訪問擺在首位。
Of course, having a pause before comments appear is better than having a site that doesn’t work.當然,有一個暫停前的評論似乎是較有一個網站是行不通的。 But not everybody who is looking to improve WP’s performance is at a place where their site is crashing constantly.但並非人人都誰是展望,以改善可濕性粉劑的表現正處在一個地方,他們的網站是撞毀不斷。 My site for instance is still chugging along fine performance-wise, but I’ve been warned by my Web host that it’s starting to take up more server resources than they’re comfortable with, so I’m looking at ways to improve performance.我的網站,例如仍是chugging沿優良表現明智的,但我已經警告我的網頁主機,它的出發採取更多的服務器資源比他們感到滿意,所以我期待在如何改善性能。 Still, because my site visitors enjoy using the comments section to talk to one another more or less in real time — and because, I suspect, a long pause after commenting would result in fewer visits on their part (and thus less revenue to me) I wouldn’t implement a technique like yours except as a last resort (ie if my Web host got fed up and was threatening to shut me down).還有,因為我的網站訪問者樂於使用的評論部分,以相互交談更多或更少,在真正的時間-因為,我懷疑,長期的暫停後,評論將導致更少的訪問對他們的一部分(從而收入減少向我)我不會實施一項技術像您一樣的,除了作為最後手段(即如果我的網頁主機得到厭倦了,並威脅要關閉我下來) 。 Still, I’m sure there are plenty of blogs for whom discussion and comments are not key features of the site, and the technique you outline would be very helpful to them.仍然,我敢肯定有很多的博客為誰討論和評論並非主要特點的網站,以及技術,你大綱將有很大的幫助他們。
jf櫻美林
May 4th, 2006 at 2:44 pm 2006年5月4日在下午2時44分
[...] Falls Ihre Seite laufend mit neuen Kommentaren überschüttet wird, so sollten Sie auf eine Installation der Caching-Funktion verzichten oder diese zumindest nicht im “Auslieferzustand” einsetzen. [ … … ]屬於ihre打印laufend麻省理工學院neuen kommentaren überschüttet wird ,所以sollten女士auf eine安裝明鏡緩存- funktion verzichten奧得diese zumindest nicht即時通訊“ auslieferzustand ” einsetzen 。 Da die Cache-Dateien in diesem Fall eine zu kurze Gültigkeitsdauer haben, könnte die Installation Ihren Server mit den zusätzlichen Aufgaben überlasten (oder zumindest nicht entlasten).大模具緩存dateien在diesem屬於eine祖kurze gültigkeitsdauer haben , könnte模具安裝ihren服務器麻省理工學院書齋zusätzlichen aufgaben überlasten (奧得zumindest nicht entlasten ) 。 Sollten Sie trotzdem nicht auch ein Caching verzichten wollen, dann können Sie mit dem folgenden kleinen Hack für Abhilfe sorgen. sollten女士trotzdem nicht auch艾因緩存verzichten wollen , dann k鰊nen女士麻省理工學院的DEM folgenden kleinen哈克f黵abhilfe sorgen 。 Damit wird die Aufbereitung der Caching-Seite nicht von neuen Beiträgen oder Kommentaren abhängig gemacht, sondern erfolgt zeitgesteuert. damit wird模具aufbereitung明鏡緩存-打印nicht馮neuen beiträgen奧得kommentaren abhängig gemacht , sondern erfolgt zeitgesteuert 。 Der Nachteil: neue Kommentare oder Beiträge werden nicht sofort, sondern erst nach der zeitbasierten Löschung des Caches sichtbar.明鏡nachteil : neue kommentare奧得beiträge werden nicht sofort , sondern erst nach明鏡zeitbasierten löschung萬緩存sichtbar 。 [...] [ … … ]
November 17th, 2006 at 2:41 pm 2006年11月17日在下午2時41分
Thanks for the tips.感謝提示。 I am not sure this will help because this looks like suitable for blogs with a lot of comments.我不知道這將幫助,因為這看起來像適合博客了很多意見。
My problem is a little different, not so much on comments.我的問題是一個有點不同,而不是這麼多的意見。 My blog is having too many visitors, thus have too many processes running at the same time.我的博客是有太多的遊客,因此有太多的進程運行在同一時間內。 How to optimize this?如何優化呢?
November 17th, 2006 at 10:21 pm 2006年11月17日在下午10時21分
If this tip doesn’t help then you are pretty much due for a dedicated server如果此提示,不利於那麼你是非常到期專用服務器
November 18th, 2006 at 12:48 pm 2006年11月18日在下午12時48分
[...] Since the machine was limited by CPU, I decided to fire up DTrace to see where the httpd process was spending it’s time. [ … … ]由於機器有限的CPU ,我決定要成立消防DTrace的,看看那裡的httpd進程是花的時間。 The DTrace results indicated that Apache was spending a considerable amount of time compiling PHP pages, and issuing queries to the back-end database.該DTrace的結果表明, Apache的是花了相當長的時間編譯PHP的頁面,並發出疑問,到後端資料庫。 Since I only update my blog a few times each week, I started to wonder if there was a way to turn the pages I created in Wordpress into static content.因為我只更新我的博客幾倍,每星期,我開始懷疑,如果有辦法把我創建的頁面在WordPress到靜態內容。 After reading through a variety of wordpress resources, I came across the wordpress cache #2.後讀通過各種WordPress的資源,我來到全國各地的WordPress緩存# 2 。 This super useful plugin will create a static represetnation of each dynamically generated page, and serve that file instead of the page that wordpress woudl dynamically generate.這個超級有用的插件,將創建一個靜態represetnation每個動態生成的網頁,和服務於該文件而不是網頁的WordPress將動態生成。 Once I got wp-cache2 installed, the results were right on par with what I orginally thought they should be: [...]一旦我得到可濕性粉劑- cache2安裝,結果是正確的看齊,與我orginally認為,他們應該是: [ … … ]
January 1st, 2007 at 12:23 am 2007年1月1日在上午12時23分
[...] I recommend it over external caching engines like eAccelerator because it is senstive to changes in WordPress content and will automatically refresh the cache. [ … … ]我建議它的外部高速緩存引擎,如eaccelerator ,因為這是敏的變化,在WordPress的內容,並會自動刷新緩存。 However it has a downside.但它有一個壞處。 On highly commented sites the effects of caching is negated because of frequent cache refreshes.對高度評價網站的影響,緩存是否定的,因為頻繁的高速緩存刷新。 This can be addressed by this tip: How to improve performance of highly commented WordPress blogs [...]這可以解決這個提示:如何提高的表現,高度評價WordPress Blogs的[ … … ]
March 20th, 2007 at 8:18 pm 2007年3月20日在下午8時18分
Would you have any tips for configuring WP-Cache 2 with interactive plugins like GamerZ PostRatings, or comment karma?將您有任何提示配置可濕性粉劑緩存2與互動插件一樣, gamerz postratings ,或評論的因果報應?
I’ve tried using the mfunc mods in my designs, but they never seem to work… do you know if a mfunc has to be within a if function_exists call?我試過使用mfunc MODS的在我的設計,但他們似乎從來沒有工作…你知不知道如果mfunc要一個,如果function_exists通話?
This is driving me nuts.這是我駕駛的堅果。
Eric李家祥
May 1st, 2007 at 8:34 am 2007年5月1日在上午8時34分
Whilst I don’t have a high volume of comments across all posts on my blog, there are 2 posts which have a combined total of more than 1200 comments and this seems to be bogging down the site, or at least the loading of those 2 pages.雖然我不高量的評論,所有的職位對我的博客,有2個職位,其中有一個總和超過1200年的評論和這似乎是bogging下來的網站,或至少載貨那些2頁面。 I installed wp-cache but since installing I have also started getting internal server 500 errors for one of the posts.我安裝了可濕性粉劑緩存,但由於安裝,我也開始使用內部服務器500錯誤之一的職位。 Is your solution the only way of of speeding up these pages?是您的解決方案,唯一的辦法加快這些網頁呢?
May 2nd, 2007 at 10:58 am 2007年5月2日在上午10時58分
You can always buy a bigger and better server / load balance it, also use memcached, eAccelerator etc. Each of them works in different ways to improve performance.您可以隨時購買一個更大更好的服務器/負載平衡,也使用memcached , eaccelerator等,它們各自的工程在不同的方法來提高性能。
You may want to read this article for details:您可能想要閱讀此文章詳情:
5 Golden Tips For WordPress Performance Optimization / Slashdot-Digg Protection五月黃金的秘訣在WordPress性能優化/ Slashdot的- digg保護