10 ways to deploy more environmentally friendly Drupal web applications

Small margins are insignificant in relation to the individual user, but when related to millions of users, small changes have a big impact on energy consumption. Drupal on the LAMP stack can be deployed to use minimal CPU cycles, thereby consuming less energy.

There is a well known axiom that a friend recently shared with me. She was a student of Maharishi Mahesh Yogi who used this expression often. Incidentally I also remember my yoga teacher, Yogiar Ramiaah saying it.

Well begun, is half done.

Planning

Creating optimized web applications begins with planning. A clear plan without feature bloat is kinder to environment.

  1. Create a clear project plan with a carefully selected set of features for the project's first release. Avoid feature bloat.
  2. Start small and plan for growth. Scale your deployment as the project grows. There is little reason for having a dedicated cluster to serve 1000 daily, unique anonymous users. Select a web host that offers virtualization capable of supporting traffic and usage spikes.
  3. Carefully select features that are absolutely necessary for a pleasant user experience; and that solves the project's challenge.
  4. Carefully select Drupal modules for the required features; and when adding new modules to an existing project. Create an internal process for evaluating modules. This process is more important when your core set of modules are deployed accross multiple servers, serving multiple websites.
  5. Test before deploying new modules by benchmarking how they affect performance. Apache AB testing provides a "processing time" measurement. Less is better.

Optimization - Optimized Drupal deployment, caching and tuning LAMP

  1. Opcode caching - Drupal is a PHP based platform. Each PHP request has to be interpreted and compiled by the server, which uses CPU cycles to process the data. An "opcode" cached php script is compiled only once, stored in memory where it can handle millions of requests. This reduces CPU cycles and processing BIG TIME.
  2. Single core with shared modules for multiple sites - The PHP code of a single Drupal core with shared modules only has to be compiled once. Our single core installs happily serve out ~80 000 pages daily to multiple websites running on the same core. This includes logged in and anonymous users. Our virtual servers run a single Drupal core with shared common modules. Several low usage websites run on each virtual server.
  3. Pressflow - We recently began switching all our Drupal cores to Pressflow. Pressflow is like Drupal on steroids. It's faster and offers better support for external caching and clustered deployments. If you run a Drupal shop or manage several sites, consider Pressflow for your core. Four Kitchens do an awesome job of keeping Pressflow in sync with the latest Drupal releases.
  4. Optimized LAMP (Linux, Apache, MYSQL and PHP) - A fine tuned PHP interpreter, optimized MYSQL and Apache, will reduce overall CPU usage. Static content may be served via a lighter web server than Apache. We are considering moving to Pantheon (we would have ages ago if we were not SO happy with our present hosting company - KnownHost). Pantheon is hosting for Drupal based on Mercury, which is an optimized hosting stack that was created for Drupal websites. Chapter 3 provide Mercury for free, which can be downloaded and installed on your server or VPS.
  5. Static file caching with Boost - The Drupal Boost module is kinder to environment. It will create a static cached file of dynamic pages. Your page will be served as a standard html document. You may skip all of the above and begin with this! Boost works on multi-site installs.

Not too long ago, Ubuntu Desktop had a bug in it's volume control applet. The bug resulted in excessive CPU cycles. This little bug was present in a released version of Ubuntu, which had millions of worldwide users. I don't remember the exact figures, but a developer who commented on the bug report in Launchpad, worked out the excess energy consumption in terms of watts. On a global scale it was big.

A global community of web developers and development shops can have a positive environmental impact by developing web applications that use fewer CPU cycles.

Tags:

Conversation

Post new comment