Green LAMP: Save energy and the environment by optimizing your website



February 03, 2016

This article originally written for

Optimized websites are better for the environment. Why? They are significantly faster, more usable, with content that’s optimized for SEO and user experience. This means that both computers and users spend less time waiting for the page to load.

Back when I first was creating websites, back in 1995, the Internet was considerably simpler. People were using the web at that point, but it wasn't embedded in our lives like it is now. At that time the ecological footprint of the Internet was pretty small. Sure, there was already a network of computers that spanned the globe, but there weren't the giant data centres that there are now.

Today, The Information and Communication Technology (ICT) sector is estimated to have contributed around 2 to 2.5% of global greenhouse gas (GHG) emissions according to the International Telecommunication Union. There are a variety of studies on this, but we like this breakdown of energy consumption, which is still growing quickly as we find more ways to use the Internet.

The web industry hasn’t been particularly proactive on this issue, but Benefit Corporations like Manoverboard are doing their best to raise awareness through blog posts like Creating a Responsible, Earth-Friendly Website. Additionally, Google's decision to factor search rank on page speed caused many websites to make performance a higher priority, and the rise of mobile usage is helping drive performance, since bandwidth is often limited.

This is a big issue.

In this article, I'll cover how to optimize your server to save energy and time.

Server optimization

All websites run on servers and most are using Linux, Apache, MySQL, and PHP/Python (LAMP). There are a lot of variations, so we can’t address them all here, but we can cover the basics.

Page compression

Page compression can be done in Apache or within your PHP application. Make sure your pages and CSS files are compressed (you can use with Gzip) and set an Expire Header for the Static Content for extended browser cache.

Cache management

Consider installing Varnish or a similar tool. Cache management can be done in Drupal with the Varnish module (7/8-dev) and in WordPress with Purge Varnish Cache. Varnish is a powerful page caching tool that is configurable, and for some sites we recommend setting up a separate Varnish server devoted to serving cached pages.

Memcached is a high-performance, distributed memory object caching system that can be used to speed up your Drupal site by alleviating database load. In Drupal, use either Memcache module (7/8-dev) or Memcache Storage module and in WordPress Memcached Object Cache. This can be run alongside Apache or on it's own server, depending on expected demands.

In Drupal 7, install Alternative PHP Cache (APC) to and the APC module to cache PHP code. In WordPress you can use APC Object Cache Backend. You can also do this with Drupal 8, but look forward to using PHP7, which runs way faster, than earlier versions of PHP. PHP7 may have a version of APC in the future, but it isn’t available yet.

Optimize performance

You should also look at optimizing your database on a regular basis. The DB Maintenance module (7/8-dev) in Drupal and WP-Optimize in WordPress will optimize your database on a regular basis. Much of this could also be done using a cron script using MySQL commands in off-peak hours too.

There are a great many other suggestions from the community on how you can tune your server. And, there is an active community of Drupal developers interested in high performance configurations. There are also videos on MySQL performance improvements for Drupal.

Also consider using PHP-FPM (FastCGI Process Manager) and especially HHVM (Hip Hop Virtual Machine) which offer performance enhancements. New versions of Drupal and WordPress should both run fine with HHVM although it's not identical to PHP, so there may be problems with some contributed modules/plugins.

Content delivery

Think of using a Content Delivery Network (CDN) to deliver some of your content. A CDN serves content from a location that will be optimized for the visitor's location. Wim Leers has written a series of great posts on setting up the CDN module to optimize your site. The CDN Enabler plugin for WordPress works in a very similar way. Mightybytes has written a good article on why sharing code like this is good for sustainability.

We should soon be able to adopt HTTP/2 because it offers performance improvements and may negate the advantages of aggregating CSS/JS files. At the moment there is great browser support for HTTP/2, but less than 2% of sites support this new protocol. It’s still usually best to assume that less HTTP requests = faster page loading.

Hardware upgrade

Sometimes though you just need to spend a bit more on faster hardware, more RAM, and solid state drives. Having multiple servers can help deal with busy sites.

Think about switching to a green hosting company. Look for a host that is using green energy and has a strong environmental policy. Your servers are running 24/7, so having a green host can have a significant impact on your CO2 output. Mightybytes has a blog and Manoverboard a white paper about green hosting that are worth checking out.

Evaluate your performance

Finally, when you've done all of your changes, don't trust that enabling these tools will just work. Page optimization needs to be evaluated to determine that you are actually delivering faster pages.

Use Yahoo's YSlow, Google's Insights, or WebPageTest to evaluate web pages, and note that your performance on various pages may vary. Yahoo! also has a list of best practices that are worth considering.

Page speed will always vary based on load. Consider using the Apache HTTP server benchmarking tool to simulate how your website performs with a heavy page load. Drupal’s Performance Logging and Monitoring module and WordPress' P3 (Plugin Performance Profiler) plugin can help you track your performance over time as well.


In the end, it's more simple than you might think to make a difference for the sustainability of your website(s) and the environment. Regardless of your technical expertise, there are improvements to be made at any level of website development. All you need to do is use the tool's at your disposal.

About The Author

Mike Gifford is the founder of OpenConcept Consulting Inc, which he started in 1999. Since then, he has been particularly active in developing and extending open source content management systems to allow people to get closer to their content. Before starting OpenConcept, Mike had worked for a number of national NGOs including Oxfam Canada and Friends of the Earth.

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.