WordPress Preloading Posts / Pages / Images – What, when and how!

Preloading posts is one of the popular¬†recommendations by most articles on the internet on how to speed up your WordPress site. Since, most WordPress sites (I’d say over 99%) have little or negligible traffic, it is highly recommended to get the posts preloaded in the cache so that the visitors do not have to wait to get the generated on-the-fly that actually takes some time. In this case, by the time the post is generated to be served to the visitor, the visitors may have gone to visit another website. So, do I recommend preloading? Yes (for low traffic sites) and no (for high traffic sites). Read more for a bit of explanation on this…

Continue reading “WordPress Preloading Posts / Pages / Images – What, when and how!”

Full Page Caching Options for WP Blogs

Caching ecosystem around¬†WordPress grows constantly with newer caching plugins coming up every year. In order to arrive at the best solution for caching, one needs to understand how everything fits together in a cache. There are multiple caching layers available. When a user sends a request to a particular page in a domain, for example home page of this domain, the reply doesn’t come fresh from the site. If it needs fresh data, it has to be prepared from scratch by this site. That in turn would take a lot of time to prepare and then send it to the user’s browser. The visitors would have closed the website and would have turned to another site, if the request doesn’t arrive within a second (in most cases). In order to achieve this 1-second milestone, the sites incorporate different caching layers to serve the request. Continue reading “Full Page Caching Options for WP Blogs”

WP Super Cache with Caddy Web Server

Web server market is dominated by Apache HTTP server that enjoys its status because of its open source nature and because of its role in bringing the masses to the world wide web. Without it, we may not have had so many web hosts and web sites. However, its memory footprint has been a concern until today.

Nginx is the second largest in terms of Web Servers Market Share. While Nginx is still open source, the constant upselling of its commercial subscription may not be welcomed by everyone. Don’t get me wrong. I use Nginx too for its low memory footprint and its efficiency in serving static files.

Microsoft’s IIS is third most popular web server. It is rock solid, having its own use cases.

OpenLiteSpeed is very limited in its functionality.

Continue reading “WP Super Cache with Caddy Web Server”

Efficient 301 Redirects

Traditionally, web sites use either www or non-www version to display their content to the visitors. Sub-domains are also becoming popular in recent times. When www is chosen as the preferred domain when installing WordPress (or after installing WordPress), whenever a visitor types non-www version of the site, WordPress redirects the visitor to the correct URL, the www version the site, through an internal 301 redirect. Google recommends this 301 redirect and Google WebMaster Tools has an option to set the preferred domain too. Continue reading “Efficient 301 Redirects”

Early Spam Comment Removal

No one likes spam. Akismet has been doing a great job in keeping WordPress blogs clean from spam comments. Thousands of spam comments per hour can increase the overload in the database. You know what I mean, if your site is famous and yet if you are running on a server with limited resources. You may want to make sure your site’s database is as lean as possible. Ideally, you’d want to clean the spam from the WordPress as often as possible. An hourly / nightly / weekly cleaning is what you’d probably need. By default, Akismet purges old spam comments that are over 30 days old. Here’s a little script that is triggered by a cron job and runs on the server side, thus reducing the overhead on WordPress to make it faster. Since, this little script can increase the performance (to a tiniest extend), you may choose this, instead of waiting for Akismet to clear spam after 30 days. Continue reading “Early Spam Comment Removal”

Moving WP .htaccess rules to httpd.conf

Apache HTTP Server LogoRecently, in one of my clients’ server, we decided to move to the traditional Apache with mod_php instead of Nginx with php-fpm, after going through the pros and cons of each setup. If you are not aware already that AllowOverride All brings a major performance lag into the whole setup. To overcome this, we can move the rewrite rules written on any part of your site into Apache’s configuration file (apache.conf or httpd.conf or any other name depending on the distribution you use). By moving the rewrite rules into the httpd.conf, we could disable AllowOverride altogether for a particular site and make this Apache with mod_php server stack a bit faster than Nginx with php-fpm stack. Here is how you can move all the rewrite rules into your server’s config… Continue reading “Moving WP .htaccess rules to httpd.conf”

Varnish 301 Redirect

Varnish logoVarnish is a powerful caching HTTP reverse proxy server. It can sit in front of Apache or Nginx and can cache the requests that are configured to be cached. Varnish offers a lot of flexibility on what to cache and what not to cache. However, it doesn’t offer any simple redirection by default. When it stands in front of a general purpose web server, it sends the requests to the backend (in our case, Nginx), and then sends the backend response to the browser. While this is the natural process, there are a couple of ways to reduce this round-trip and save a bit of time. After all, every millisecond counts! Continue reading “Varnish 301 Redirect”

Get The Best Out Of “Google XML Sitemaps” Plugin

Google XML SitemapsGoogle XML Sitemaps plugin for WordPress is probably one of the popular plugins in WordPress plugins repository. At the time of this writing, it has been downloaded over 8 million times! It is not a small feat by any means. However, if it is used incorrectly, it can drag your site’s performance considerably. Some web hosts even alert the site owner, if this plugin is used in their sites and politely ask the site owner to remove it at the earliest. So, what’s wrong with this plugin and how can you make use of it without affecting your site’s performance (and your host’s CPU). Let’s dive in!

Continue reading “Get The Best Out Of “Google XML Sitemaps” Plugin”