SP Blogger

Make Money Online, Blogging Tips, SEO, Investment Guide, Financial Planning…

I published lot of advertisements on my blogs in order to make more money. The more the merrier. However, most of the advertisements are in JavaScript format. And JavaScript will slow down your blog because it block parallel downloads. Browser need to finish process it before continue to the next one. If that particular JavaScript ‘hang’ somehow, same apply to your blog. Therefore, I promised to myself to reduce advertisements on my blogs once I reached certain amount of revenue. I reached it and it’s time to delete those non-performing advertisements that slow down blog.

I tried Malaysia advertising companies like Advertlets, Admax Network, Innity Performance Network and Nuffnang. Only Nuffnang performs well compare to the others. However, Nuffnang has a serious slow loading issue on its ads. My blogs can’t even load when Nuffnang leaderboard ad on header ‘hang’. It needs to wait for several minutes until it is timed out then my blog can continue loading. Therefore, I removed both leaderboard and rectangle ad. Left only 1 skyscraper ad on sidebar. Why? My blog right sidebar is the second last component to be loaded (the last one is footer). So readers don’t have issue to read the article even when Nuffnang ads ‘hang’. Nuffnang ad will be gone from JayceOoi.com if it is still slow from loading. Besides, its revenue cannot catch up with JayceOoi.com traffic like Google AdSense and Vibrant. Does it worth to continue publish?

During lot of testing and optimizing blog with WebPagetest, Nuffnang ad is not the only one that slows down my blogs. ContextWeb ads slow down too. Therefore, lot of ContextWeb ads had been axed too. I published 7 ContextWeb ads in 1 page last time (yes, I know that’s a lot. What to do? I want more money. :P ). And reduced to 3 main types of ads (rectangle, leaderboard and skyscraper) now. Will further reduce it if ContextWeb revenue does not meet my target (now still don’t). Cut cut cut…

Reduce advertisements on blog == decrease in revenue. But I am willing to take it as readers like you and me don’t like to wait for long for 1 page to load, right? By removing those non-performing ads, it might increase other ad companies’ revenue due to faster loading time. Why? Vibrant In-Text Ads will only be loaded after everything is loaded (Ad script at footer). If Nuffnang ads ‘hang’, Vibrant ads will not be able to see the day light anymore. Do you get the point?

Is your blog filled with lot of advertisements? If yes, it’s time for your blog to keep fit. ;)

Most of our WordPress blogs are hosted on Linux Apache server. And there is a guide to speed up your website with Apache .htaccess file tweaks. Saw this one at AllGure.NET for quite some times but did not implement it until now. By the way, this is one of the W3 Total Cache feature ~ “Instant” second page views (browser caching after first page view). But too bad, I enabled it on W3 Total Cache and failed to work. So I stick with AllGure.NET guide, and work like a charm.


“Instant” second page view

Above is the second page view of spBlogger.com. spbloggger.com’s images, CSS, JavaScript are cached at browser. Therefore, only the first line is coming from spBlogger.com and the rest from others like Nuffnang, Facebook, Google, ContextWeb…

If you did not implement it, you will see lot of not modified 304 status codes responded by your web server. You are wasting server CPU resources and user time as browser actually makes a request to web server to request for those files which are not modified. And they should be cached at browser level. So no addition requests to web server. Here are the examples using WebPagetest before and after.

How to speed up WordPress blog with Apache .htaccess?

# Turn on Expires and set default expires to 3 month
ExpiresActive On
ExpiresDefault A7257600
ExpiresByType image/x-icon A14515200

# Set up caching on media files for 1 month
<FilesMatch “\.(gif|jpg|JPG|jpeg|png|PNG)$”>
ExpiresDefault A2419200
</FilesMatch>

# Set up caching on commonly updated files 1 month
<FilesMatch “\.(xml|txt|html|js|css)$”>
ExpiresDefault A2419200
</FilesMatch>

<FilesMatch “\.(ico|gif|jpg|JPG|jpeg|png|PNG|css|js|html?|xml|txt)$”>
FileETag None
</FilesMatch>

# gzip compression
<IfModule mod_deflate.c>
<FilesMatch “\.(js|css)$”>
SetOutputFilter DEFLATE
</FilesMatch>
AddOutputFilterByType DEFLATE text/css application/x-javascript text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon
</IfModule>

By adding these at .htaccess file, your images will be cached at browser. And CSS, JavaScript, XML and HTML will be compressed by the Apache server before send to browser. However, not all the web hosting can support gzip compression properly. I tried it on my 3 web hosting with same configuration. HostMonster and Just Host do not compress HTML, CSS and JavaScript most of the time. Only HostGator does the compression work perfectly. Wonder why…

HostMonster and Bluehost list out all the slow SQL queries that use more than 1 second query_time in $HOME/tmp/mysql_slow_queries folder. I guess they have poor performance DB server because the other 2 web hosting that I use ~ HostGator and Just Host don’t have it. Anyway, if you see lot of log files there, this mean that you are using quite some CPU resources and getting sooner to get suspended like I did. When you look into these logs, you will find most of them are WordPress standard SQL queries and you can’t do any optimization on the queries themselves. But there are other ways to reduce access to DB server like wp-config.php tweaks.

How to speed up WordPress blog with wp-config.php tweaks?

By adding WP_HOME and WP_SITERUL, WordPress does not need to access to DB server to grab these 2 values every time when header or footer call these for RSS, CSS, JavaScript location on your theme.

define(‘WP_HOME’, ‘http://spblogger.com’);
define(‘WP_SITEURL’, ‘http://spblogger.com’);

WordPress Security Keys. Have it pre-defined in wp-config.php to eliminate WordPress to generate there salts for you if none are provided. Get yours here.

define(‘AUTH_KEY’, ‘xxx’);
define(‘SECURE_AUTH_KEY’, ‘xxx’);
define(‘LOGGED_IN_KEY’, ‘xxx’);
define(‘NONCE_KEY’, ‘xxx’);

Disable post revision function. This will reduce number of rows in WordPress post table == faster page finding and loading. I don’t use it anyway, so I disabled it.

define(‘WP_POST_REVISIONS’, false);

Be sure to check out AllGure.NET post for more info.

As I said, HostMonster and Bluehost are famous with CPU Throttling. Therefore, a WordPress cache plugin is a must installed on their hosting. My account got suspended even I am using WP Super Cache for quite some time. After do a comparison between WP Super Cache and W3 Total Cache, I decided to use W3 Total Cache as it is better than WP Super Cache.


HostMonster CPU Limiting Factors (Throttling)

I am using W3 Total Cache v0.9.1.3 on WordPress v3.0.4. W3 Total Cache is working out of the box with default settings. However, I discovered HTTP (gzip) compression is not working on HostMonster and Just Host most of the time. Therefore, CSS, JavaScript and HTML are not compressed with gzip. Only HostGator works perfectly. Must be web hosting issue.

On the other hand, W3 Total Cache failed to cache other object like images with expires header, cache control header and entity tag (eTag). None of the 3 web hosting that I use is working. So no “Instant” second page views (browser caching after first page view). Besides, its minify function might broke your other plugin’s CSS and JavaScript. I tried on PrettyGirl2u.com and it failed totally. So use it carefully.

By the way, I enabled database caching via disk. It does reduce some CPU resources on HostMonster. But it can’t help much if your visitors or yourself is ‘touching’ DB server directly by posting comments or editing posts. As you can see picture above on the last 1 hour, CPU usage spiked because I was replying few comments.

Overall, W3 Total Cache is a must installed plugin on WordPress blog. Not perfect but worth to install. And do tweak it until you get the best performance out of it.

Download W3 Total Cache WordPress Plugin here.





Email Updates

Enter your Email to subscribe:


Subscribe to SP Blogger feeds