Drupal Optimization

Scaling Drupal 8

1. Enabling Drupal Cache
One of the simplest approaches for significantly improving your site’s performance is to utilize Drupal core’s
caching mechanisms. Caching is a means for storing the rendered version of a page, block, or view so that
Drupal does not have to assemble those components every time a visitor requests a page.

Drupal 8 core comes with two modules that empower caching on your site:

Using MongoDB with Drupal 7

MongoDB can be easily integrated with Drupal 7 to support millions of dynamic web pages on a daily basis to speed up the websites. This document oriented application is a schema less database that can store large files without complicating your stack.

Here’s a look at how to install MongoDB on Linux and integrated it with Drupal 7.

1. Installing the MongoDB packages.

Using Redis with Drupal 7

Redis is a very powerful cache system for static pages of Drupal websites. It is a very popular open source software that has become an important aspect of speeding up drupal websites. The core functionality of Redis stems from its data structure servers

1. Install Predis libraries

High Performance Web Site Tips

• Make fewer HTTP requests to reduce object overhead.
• Use a content delivery network.
• Add an Expires header.
• Gzip/compress text components.
• Put stylesheets at the top in the head.
• Put scripts at the bottom of the body.
• Avoid CSS expressions which are CPU-intensive and can be evaluated frequently.
• Make JavaScript and CSS files external.
• Reduce Domain Name System (DNS) lookups to reduce the overhead of DNS
delay by splitting lookups between two to four unique hostnames.
• Minify JavaScript.

Infrastructure Design For Drupal Apps

Horizontal and Vertical Scaling
There are two approaches to scaling out an infrastructure to add additional resources:
horizontal scaling (“scaling out”)
vertical scaling (“scaling up”).
Horizontal scaling involves adding additional servers while vertical scaling involves adding more resources
to existing servers.
A good infrastructure plan will take both of these scaling approaches
into account, as there are times when one may be more appropriate than the other.

PHP Apache MPM Settings

Apache is one of the most configurable and flexible HTTP servers in existence. It is in
fact so configurable that you can even change its process model via your choice of
multiprocessing module (MPM). The two major core MPMs are Prefork and Worker:

Render block caching example

Drupal’s render API takes a structured array of data and converts it to HTML, running
it through the theme system and collecting associated assets such as CSS and JavaScript.
One of the more powerful but underused features of the render system is its integrated
cache handling.
When writing code that generates HTML, there are two main phases that the content
goes through:
1. Building the array of data (e.g., a list of nodes based on the results of a query)

Several approaches for reducing image requests

Images embedded in content via the tag are relatively hard to optimize in terms
of the number of requests. You can optimize images for bandwidth using image derivatives,
which ensure the images are scaled or cropped to the size they will be served at.
Drupal 8 goes further by supporting responsive images via the Picture module (also
available in Drupal 7 as a contributed module), so that the correct image derivative—
and only that image derivative—is loaded based on breakpoints. For very image-heavy

Scaling Drupal (Memcached, varnish)

The memcached system saves arbitrary data in random access memory and serves the data as fast
as possible. This type of delivery will perform better than anything that depends on hard disk access.
Memcached stores objects and references them with a unique key for each object. It is up to the
programmer to determine what objects to put into memcached. Memcached knows nothing about the
type or nature of what is put into it; to its eyes, it is all a pile of bits with keys for retrieval.

Decreasing Server Timeouts

There are a variety of timeout settings in each layer of a LAMP server stack. The importance of lowering
timeout settings is that it prevents a slow or unresponsive service from causing a process load pile-up on
your web server. It is advisable to decrease all timeout settings as low as you can tolerate.

Pages

Subscribe to RSS - Drupal Optimization