Archive for March 19th, 2006

final

Sunday, March 19th, 2006

還要拼一個禮拜… orz 來個全 A 的學期吧… orz

How to prepare your site for Digg Effect (Diggstruction)

Sunday, March 19th, 2006

No more database error due to too many connections.When a site was dugg to the front page of Digg, the amount of requests to the server will usually take down small sites running on relatively low end hardwares (small RAM, slow CPU, HDD). To prevent this from happening to your site (specifically, WP blogs), there are things you can do to maximize what low end hardwares can manage, and therefore prevent the Digg Effect.

From last experiment, I am very aware this $69/mo (now $99/mo) 1&1 Dedicated Root Server with 2.0Ghz Celeron, 512MB RAM and 40GB HDD cannot take on Digg Effect without doing some tweaking. Here are the measures I’ve gathered:

1) Cache it: WP-Cache 2.0

A very-easy-to-install-and-use plugin. By creating cached pages, it reduce the php code parsed by the web server, and also eliminate the query to mysql database. Both speeds up the page load dramatically.

You can test to see the difference by doing very simple test, this is what I get:

Without cache:

time wget http://blog.tarotoast.com/
>> 0.005u 0.007s 0:01.36 0.0% 0+0k 0+0io 0pf+0w

With cache:

time wget http://blog.tarotoast.com/
>> 0.003u 0.012s 0:00.02 50.0% 0+0k 0+0io 0pf+0w

I don’t really know what all numbers mean, but I know the time for the request is reduce from 1.36 second to .02 second. Keep in mind, however, counter plugins (like Counterize) will not count requests for cached pages (so you don’t feel as good).

2) Apache 2: MPM Worker

Taken directly from Apache’s website:

This Multi-Processing Module (MPM) implements a hybrid multi-process multi-threaded server. By using threads to serve requests, it is able to serve a large number of requests with less system resources than a process-based server. Yet it retains much of the stability of a process-based server by keeping multiple processes available, each with many threads.

In order to use the php module, you need to compile it with thread safety.

3) Stress Test with ab

ab stands for Apache Benchmarking

ab -n 100 -c 100 -d http://URL

This will give you an idea how your webserver can handle traffic.

*Warning: set the number small and increase it slowly.

4) Additional Tweakings

Digg

All Rights Reserved Copyright © 2008 Design by StyleShout and Clazh