26. Implement caching
• Types of caching
engines:!
Standard Drupal Cache!
APC - standard drupal cache +
memory?!
Memcache!
Static page cache / Boost !
27. Standard Drupal Cache
• positive !
provides caching out of the
box!
• negative !
relies upon the database for
storage, which results in a lot
of reads/writes which can
result in table or row locks,
etc.!
28. APC
• positive !
much faster performance than
memcached!
• negative !
not networkable, so not suited
to multiple webheads!
29. Memcache
• positive !
standard drupal cache +
memory + multiple servers!
• negative !
limited control over when and
how things disappear from
cache!
30. Static Page Cache/Boost
• positive!
drupal flexibility +
performance of static files!
• negative !
generally works only with
anonymous users!
32. Page Cache
• positive !
allows full pages to be
cached, and thus we can serve
many more page views on a
single server!
• negative !
only works for anonymous
users!
33. Block Cache
• positive !
configurable to work with
anonymous users, as well as logged
in users!
can be page specific, user specific,
both or site wide and set to expire at
specified intervals!
• negative !
hard to control the expiration of
data outside of the specified
intervals!
34. Implement caching
• Types of programmatic
cache:!
Static variable cache!
Programmatic data cache!
35. Static Variable Cache
• positive !
eliminates often duplicate rendered
objects!
core already uses this in some places so
that a second node_load() in a page
!
request doesn't hit the database
• negative !
Only applicable in the course of a single
web request!
36. Programmatic Data Cache
• positive !
Expensive items can be cached
for a period of time!
Easily added into custom
modules or custom themes!
• negative !
Difficult to know where to do
it, and invalidating content
becomes complicated!
38. Ongoing monitoring - Cacti
Free!!
Monitors various aspect of your site. !
cpu utilization!
server load!
memory usage!
database activity!
Trend visualization!
Community add-ons !
40. Additional measures
Database Scaling!
Addition of read-only slave servers!
InnoDB / MyISM / Memory optimization!
You must currently patch modules or add
slave queries to your own modules!
Drupal 7 should inherently let us do this !
Hardware changes!
Load balancers!
caching!
redundancy!
42. Front end Techniques
Front-end performance matters!!
If a page takes 0.5s to generate and
7s to render, it will still seem slow!
Use YSlow! to get a score on how
fast your website's front-end is!
JS Aggregation / Compression!
Similar to CSS Aggregation !
Load JS on the bottom!
43. Front end Techniques
YSlow! in action!
before optimizing:!
212.7K (auth user)!
Almost 6 seconds!
Barely earns a ‘D’!
45. Front end Techniques
JS Aggregation!
Core in D6, Available as contrib in D5!
JS Minification!
Unsafe in PHP!
CSS Aggregation!
Available out of the box, extremely useful
in reducing the number of http requests
needed for each page. !
46. CDN
Load static assets from several
points around the country or world!
Eliminates unnecessary load on your
web servers!
Relatively cheap!
Easy to implement !
As cloud storage evolves, CDN
integration is becoming
commoditized, like SimpleCDN!
47. Front end Techniques
All images, css
and js on
SimpleCDN!
Gzip
compression!
Far-future
expiry headers!
Page size 40% of
original!
Load time down
45%!
49. Results
Far-Future
Expiry Headers!
Gzipping!
Updated
ShareThis!
212.7k to 99.96k!
5.7s to 1.7s!
D to A!!
50. Key takeaways
Follow a logical, deliberate
process!
Leverage the tools available
to you!
Use a multi-faceted approach !
Test, test, test!!
Notes de l'éditeur
A quick intro of where the session will be goingNote that focus is how to deal with problems on an existing site, rather than building a new site
People are always asking, \"Does Drupal scale?\"
All these sites attest, it can!
Please revise this as needed
I really don't know what else should go here. Please add as appropriate.
On Mac / MAMP:/Applications/MAMP/Library/my.cnf
Discuss:What load testing isWhat jMeter isWhat makes an effective plan
I:
jMeter Execution stepsStart slow to make sure the test plan works and makes senseDecide on the number of users you wanna serve in a given period of time. What we expect to get out of thisQueries into the slow query logProblem pages
jMeter ResultsVariety of reportings available:GraphsResponse time tablesSummary reports, etc.We’ll get into it more in a bit….
Discuss:How to find logsHow to identify \"slow queries\"--what constitutes slow, how to identify them in the logs
Discuss:How to find logsHow to identify \"slow queries\"--what constitutes slow, how to identify them in the logs
One example (the first query on the previous slide)
Potential pitfalls of queriespoor indexinguseless joins and/or group bysreturning too much dataGood practices for writing querieskeep it simpleknow your databe consistent and plan ahead
By enabling the Devel module:1) View the listing of queries executed2) Make note of any:Slow QueriesQueries that are repeated frequentlyAnything that is being executed yet really shouldn’t be
Optimize slow queriesLocate if any of the items being executed are the results of blocks or segments that can be cached in some wayWhat ways? - see slide
Following slides will outline postives and negatives…Types of caching engines:Caching Engines- Standard Drupal Cache
Types of configurable cache:
Page cache- positive - allows full pages to be cached, and thus we can serve many more page views on a single server- negative - only works for anonymous users
Block cache- positive - configurable to work with anonymous users, as well as logged in users- positive - can be page specific, user specific, both or site wide and set to expire at specified intervals- negative - hard to control the expiration of data outside of the specified intervals(i.e. if a block only shows a certain node type, you can set the cache to regenerate when any node type is created)
Types of programmatic cache:Static variable cache- Programmatic data cache- creating caching strategies within your custom modules- you can also do this in the theme layer (if a particular part on a user's homepage takes a lot of queries or effort to run, you could consider caching it for even 5 minutes)
only retrieve a single variable once per session- positive - eliminates often duplicate rendered objects- positive - core already uses this in some places so that a second node_load() in a single page request doesn't hit the database again.
creating caching strategies within your custom modules- you can also do this in the theme layer (if a particular part on a user's homepage takes a lot of queries or effort to run, you could consider caching it for even 5 minutes)
Discuss:Why ongoing monitoring is importantWhat Cacti isHow Cacti should be used
- Free!- Monitors various aspect of your site.
Discuss:Why ongoing monitoring is importantWhat Cacti isHow Cacti should be used
- Database Scaling
Not sure how you want to go with this part, if you want to cover each item individually like the others, or talk very briefly about each.Bullets randomly grabbed from notes...please change as you like.
Front-end performance matters!If a page takes 0.5s to generate and 7s to render, it will still seem slowUse YSlow! to get a score on how fast your website's front-end isJS Aggregation / CompressionSimilar to CSS Aggregation
YSlow! in actionbefore optimizing:The site is 212.7K
- With Drupal's JSaggregation turned on,the site already scoresmuch better.- The page has notgotten much smallerin page size (only .6kis saved because coredoesn't compress JS)- The page is almost33% faster to load andour score is muchbetter.
- CSS sprites let you reuse a single image as a background on multiple objects, again dropping the number of http requests
Not sure how you want to go with this part, if you want to cover each item individually like the others, or talk very briefly about each.Bullets randomly grabbed from notes...please change as you like.
the site with all the images, css and js on SimpleCDN.- SimpleCDN lets you
Not sure how you want to go with this part, if you want to cover each item individually like the others, or talk very briefly about each.Bullets randomly grabbed from notes...please change as you like.
- Here's the final resultwith our Apache serversending far-futureexpiry headers andgzipping html content.- To boost from a scoreof 90 - 99, I also broughtthe ShareThis module tothe 1.4 version, whichstopped it from beingincluded on every page.- Overall savings:212.7k - 99.96k page size5.7s - 1.7s page load timea
These are my inferences. Please add or change as appropriate.