• No results found

Drupal Performance Tuning

N/A
N/A
Protected

Academic year: 2021

Share "Drupal Performance Tuning"

Copied!
41
0
0

Loading.... (view fulltext now)

Full text

(1)

Drupal Performance Tuning

By Jeremy Zerr <[email protected]> Website: http://www.jeremyzerr.com

(2)
(3)

Overview

• Basics of Web App Systems Architecture

• General Web Software Optimization Strategies • Defining a Goal for Performance

• Performance Metrics

• Performance Debugging Techniques • What Can You Control?

(4)
(5)

General Web App Optimization

Strategies

• Move operations from devices with slower access to devices with faster access

• Reduce disk I/O

• Reduce bandwidth

• Use memory more efficiently • Increase parallelism

(6)

Defining a Goal for Performance

• Performance optimization can become an endless task without a goal

• What is your goal?

– Page load time (4 seconds for blogs) – Requests/sec

– Response time

(7)
(8)
(9)
(10)
(11)
(12)
(13)
(14)

Performance Debugging Techniques

• Firebug (plugin for Firefox) • Drupal Devel module

(15)

Firebug Live Demo

• Initial page load vs. loading assets • What is Blocking?

(16)

Drupal Devel Module Live Demo

(17)

What Can you Control?

• Shared Hosting vs. VPS or Dedicated Server • Shared server allows no:

– Apache configuration – MySQL configuration

– Memcached/APC for utilizing local memory – Consistent resources

– Easy upgrade path

(18)

What is Caching?

• Saving the results of computation to reuse at a later date which saves time

• Moving from slow disks to local memory • Reduce number of database queries

• Reduce number of files to serve

• Both server-side caching, and client-side caching

(19)

Drupal Performance Tuning

• Tuning strategies presented in the typical priority that you should look at them.

– Biggest improvement at lowest cost (time or money)

– First Shared Hosting

(20)
(21)

Page Caching

• Output of many database queries that are rendered into HTML to create an entire page are saved as an entire object in cache.

• Only works for Anonymous users

(22)

Aggregate and Compress CSS Files

• Parallelism is limited by web browser and web server.

• Reducing number and size of files improves performance

(23)

Aggregate/Compress Javascript Files

• Parallelism is limited by web browser and web server.

• Reducing number of files improves performance

• Configure Aggregation at Configuration | Development | Performance

• Compression has to be done outside of Drupal, recommend YUI Compressor or

(24)

Turn Views Caching On

• To address performance for Authenticated Users, look at enabling Views caching

• Set the time lengths for fine tuning your caching strategy

(25)

Turn Block Caching On

• Another way to address performance for Authenticated Users

• Modules can define whether blocks can be cached by user, by role

(26)

Disable Modules Not Used

• Reduces the chain of hooks that need to be followed

• This further reduces database queries, CSS and Javascript files

(27)

Move Static Files to a CDN

• Moving static files (images, videos, CSS, Javascript) to another server

• Reduces disk I/O and requests handled by web server

• Increases parallelism due to client-side limit • Link: Drupal AmazonS3 module

(28)
(29)

Implement Caching in Your Own

Modules

• Within your own modules, you can create your own database cache tables

• Allows you to control what is cached and how long it is kept

(30)

Check That Your Modules Use DB

Indexes Properly

• Look for database queries that take a long time when looking at Devel module output • Run those queries in MySQL using EXPLAIN

(31)

Reduce Image Sizes and Number of

Images

• Just like CSS and Javascript aggregation,

always good idea to reduce number and sizes of images

• Compression

• Repeating backgrounds • CSS Image Sprites

• Link: PNG Optimization

(32)
(33)

Apache MaxClients Setting

• Determines how many requests you can handle in parallel

• Must factor in max memory usage of each page that you can get using Devel

• Server Memory * 90% > MaxClients * Max Page Memory + Memory From Other

(34)

Enable MySQL Query Caching

• Great for saving small queries run on database tables that never or rarely change

• Doesn’t eliminate, just comes out of memory • Even just 8MB or 16MB of memory will do

wonders

(35)

Use A Memcached Server for Caching

• An in-memory cache used to move requests from disks to memory

• Drupal cache tables run from Memcached instead of cache database table.

(36)
(37)

Allocate More Local Memory for

MySQL

• Queries can run in memory instead of in temporary tables on disk

(38)

Enable APC (Alternative PHP Cache)

• Instead of PHP being interpreted every time, stores intermediate code (opcodes) in

memory

(39)

Spend Some $$$

• Separate MySQL server from Web Server • Increase RAM

• Load Balance two web servers

• Buy a separate Memcached server

(40)

Amazon Web Services < $150/mo

(41)

References

Related documents

To be able to judge absolute levels of healthy older people’s QOL evaluations with regard to some kind of standard, we additionally compared the item mean profiles of male and

The Fourth Amendment is inapplicable to seizures of abandoned property. 232 This does not mean that property momentarily left on a public sidewalk can be summarily seized

In view of health implication of crops and fishes contaminated with TPH this study was carried out to ascertain the level of total petroleum hydrocarbon in soil and groundwater

From the first application of Topic Discovery, we confirm that our pro- posed S-model which leverages social contexts is effective in preserving topics in the Twitter dataset and

We can supply you with a load balancing router which will automatically switch your internet traffic to the satellite when your wired broadband goes down, or load balance between

The content guidelines for differentiated instruction support the first UDL Teaching Method for recognition networks, provide multiple examples, in that they encourage the use

The purpose of this study was to explore the relationship between scores on the Graduate Records Examination (GRE) and first time pass scores on the National Physical Therapy