Posted on July 26, 2010 in Drupal, web hosting by Elliott BrueggemanNo Comments »

After quite a few failed attempts the get Limelight origin-pull CDN integration to work with a new Drupal Pressflow 6 site that I’ve been working on, I finally reached the magic combination of Drupal and Apache settings. While previous Drupal integrations with Akamai went smoothly, I had issues with Limelight and some assets still coming from origin and users getting bounced back to origin when logging in.

I can’t guarantee these settings will work with your site, but they work for us with PressFlow 6.17.85 and Apache 2.2. Note that you don’t need a Drupal CDN module to get origin pull integration to work.

Apache httpd.conf settings
ServerName www.mydomain.com
ServerAlias origin.www.mydomain.com
UseCanonicalName On

Pressflow settings.php
$base_url = ‘http://www.mydomain.com’;
$cookie_domain = ‘mydomain.com’;

Pressflow .htaccess
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301]

Posted on February 18, 2009 in PHP, Wordpress, web hosting by Elliott BrueggemanNo Comments »

Often as a site grows, its performance degrades sharply. This can happen for many reasons, and is typical for a site that continually undergoes maintenance. As a project ages, the content often grows as well. More data, more code revisions, more ideas to turn into code for the site, etc.

I’m exploring this subject because a site of mine is in need of a performance boost. It was a snappy little site when I first launched it, but I’ve had many more ideas since then, and I’ve implemented almost all of them. Now regular browsing through the site is noticeable slower.

I’ve got a short list of performance enhancing ideas that I’m going to explore below.

Separating CSS and JS Files

For starters, if you have inline CSS or JS, you should separate these into separate files. This is a huge performance win, because a browser can cache mystyles.css or javastuff.js, but can’t cache it if it’s included inline in your page source code. Most performance wins happen client side – taking advantage of caching is often more efficient than making slight changes to server side code, though this isn’t a rule that’s set in stone; You could have terrible server side code that slows down the site too. My site in question already has the CSS and JS files separated, but it’s worth mentioning in case you haven’t done this.

Minifying CSS and JS Files

This is something that enterprise many sites do, so I thought I would go ahead and do this. Basically, it means removing spaces,tabs, and line returns wherever possible so that the file size is smaller, but the code executes as normal. When minifying a CSS file, I prefer to leave one CSS selector per line, and then listing each CSS property after it. This reduces file size, but makes the file still human readable/editable.

Here is an example of a fully minified CSS file from MSN – http://tk2.stc.s-msn.com/br/hp/11/en-us/css/hp_1.css – I think this is overdoing it, and doing it this way is probably done through an automated script, as this would be next to impossible for a developer to edit in a development environment.

For complex sites, this is going to be a better win than for simple sites. I saw about a 20% decrease in file size. For very, very simple sites (read very), using an external CSS file can slow things down because of the server disk access time of retrieving the external CSS file. The original Google page, for example, only has a few lines of CSS, and therefore uses inline CSS. For anything more complicated, include it in an external file.

Reducing Image Use

Many blogs and news oriented sites use too many images. This slows things down for first time readers, who don’t have the images cached. A good tool to examine load times of everything on your site is Firebug, a plugin for Firefox. You can get the latest version of Firebug here. The image below is a screen capture of one of the features in Firebug that lets you examine exactly how long everything took to load. If your site is nearing half a megabyte (~500kb), it’s time to put less on your pages, or use smaller images.

firebug-example

Using Less Database Queries

This is very important on some sites, and irrelevant on others. If you are using a basic installation of Wordpress, for example, there really aren’t too many ways for an average person to speed it up, without writing the developers and telling them to use less queries next release. For heavily customized sites based on existing platforms and fully custom database driven sites, database queries can be the make or break of your site performance. Basic rule: if you are writing your own queries, and you don’t know how they perform, then you shouldn’t be writing your own queries. Having said that, never outright trust queries from other somewhat experienced developers. Developing for my firm, a Fortune 500 company, we have often encountered popular plugins for Wordpress or modules for Drupal that have queries in them that are written poorly. Just because another developer made it, doesn’t mean they did it right.

Another way to use less queries, is to outright display less content. This is easy to accomplish if you’re using a blog platform. If you’ve got 20 posts a page, reduce this number. The number of queries your blog site makes is directly proportional to the number of posts or entries it is trying to display.

Better Hosting Plan or Better Hardware

This isn’t an option for me, because the next level of hosting plans with GoDaddy is out of my current budget range. For others, however, it may be an option. It’s worth looking into.

Posted on November 16, 2007 in web hosting by Elliott Brueggeman1 Comment »

GoDaddy.com has really gotten their act together lately. To be fair GoDaddy.com has had their act together for awhile, but only now have I chosen to write about it. Almost all of my domainnames are registered through GoDaddy.com and I have moved over most of my hosting plans to them as well from Fortune City, which had terrible customer service.

At the lean price of $3.99 per month for the economy hosting plan, you can host a full featured site with plenty of bandwidth and storage space. The bandwidth is so high for a general purpose site, compared to other rival services, that you would have to be an extremely successful website to need to move up to the next level of hosting. You also get full PHP functionality and 10 MySQL databases. Other options available at the next level of hosting ($6.99 month) include support for PERL, Ruby, Java, Python, and Cold Fusion. If you choose a Windows-based hosting plan, you can also use ASP.net and MSSQL. For most websites, this will be more than enough.

One of the more useful features of all GoDaddy.com hosting accounts are free add-on apps that GoDaddy supplies. You can choose from a list of well known, free frameworks and applications like Drupal, Wordpress, Serendipity, Joomla, Mambo, PostNuke and others. Using the supplied GoDaddy application GUI, you can install any or all of the apps to your site in the folders you designate, and the database setup is moderated as well. Testing different content management systems has never been so easy.