make your drupal site perform

Post on 16-Jul-2015

319 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

15 / 03 / 2015 - Drupal Camp Cluj 2015

Make your Drupal site performLike an athlete

Gabriel Ungureanu

CEO @ AG Prime, Cluj-Napoca www.ag-prime.com

Drupal developer for 7 yearshttps://www.drupal.org/u/gabrielu

Drupal module developer and Drupal 8 Sprinter

Open source enthusiastic

Why performance matters?

Visitors spend less than 2 seconds to make an impression,

Google finds you relevant if the page loads in less than 2 seconds,

Download speeds differ depending on where your end-user is located,

People browse internet in the train, bus, airport, etc.,

Mobile devices (getting more and more) running mobile internet care about content size.

Performance key-points

Performance key-points

1. Server response time

2. Page download time

3. Page render time

1. Server response time

Check your traffic expectations,

Decide your server structure, what type of data do you host?

Anonymous user

Authenticated pages

Binary data (images, video)

Low traffic website

A virtual machine can do the job

Activate Drupal caching (per page, per block, per view)

De-activate Database logging (on the server as well)

Disable Devel module, UI modules

Activate CSS / JS Aggregation (see Advanced Aggregation for IE support :) )

Medium traffic

Memory caching (key-value pair storing)

Memcache: https://www.drupal.org/project/memcache

Redis: https://www.drupal.org/project/redisCan also persist data after restart. Useful for session storing

Heavy static content / Boost https://www.drupal.org/project/boost

High traffic

A set of three

Varnish (cache server),

Application server (Drupal) - Apache or Nginx,

Database server (MySQL).

No revision

Drupal has out-of-the-box revision control, you don’t need it in most of the cases,

https://www.drupal.org/project/field_sql_norevisions

Custom distribution

Pressflow A distribution of Drupal with integrated performance, scalability, availability, and testing enhancements.

Cloud hosting

Acquia Cloudhttps://www.acquia.com/products-services/acquia-cloud

Platform.sh / Developed by Commerce Guys https://platform.sh/

Pantheon https://pantheon.io/

The Amazon Cloud

Elastic Cloud

RDS (Database instances)

Load balancer (pay per minute)

Spot instances (run cheap clone of your EC2 instance when your computing needs grow)

http://www.ag-prime.com/ leverages AWS to host high performing sites.

2. Page download timeTime to download necessary files from the Server to the User’s device

AGGREGATE CSS AND JS FILES

Make sure that:

Aggregating the content does not break your site, Make sure CSS rules are correct and don`t rely on their position in the file.

It loads correctly on all browsers (see IE Limits per Stylesheet). There is a Drupal solution for this as well, it is called Advanced Aggregation: https://www.drupal.org/project/advagg

Use image spritesInclude more graphics into a single file,

Make the graphic files as small as possible,

Select them using CSS positioning.

Use SVG’s and IconFonts

Smaller size, vector information represents the text format that defines it;

It's scalable, this means you can easily scale your graphics when drawing a responsive layout;

IconFonts: http://css-tricks.com/examples/IconFont/

DNS & HTTP2

Make fewer DNS lookups, load the content to as FEW different domains as possible;

Aggregate content, load less files, consider using HTTP2 / SPDY;

3. Page render time

Optimise the order of your content, put the important parts at the top and move the less important at the bottom (eg. move unnecessary Javascript files at the end of your document);

Use valid markup, valid markup allows the rendering engine to make less guesses;

Use as few tags as possible. You can consider starting with a light theme, like https://www.drupal.org/project/mothership

Load content with Ajax

Quickly deliver pages from cache, then update content with Javascript at runtime;

Usage:

Commerce sites

News sites

Display comments, votes, etc.

Authenticated users

Authenticated users constantly see different content;

Pages, Blocks, Views, Forms have different cache rules;

https://www.drupal.org/project/authcache

Questions?

http://fiipractic.asii.ro/cj/back-end-development

top related