Joomla! Performance on Steroids
Upcoming SlideShare
Loading in...5
×
 

Joomla! Performance on Steroids

on

  • 18,629 views

A Prresentation on Joomla! Performance. How to make your Joomla! site load faster, smoother and with little impact on the server.

A Prresentation on Joomla! Performance. How to make your Joomla! site load faster, smoother and with little impact on the server.

Statistics

Views

Total Views
18,629
Views on SlideShare
18,109
Embed Views
520

Actions

Likes
9
Downloads
138
Comments
0

12 Embeds 520

http://weinstrasse-webdesign.com 231
http://www.scoop.it 175
http://joomlabasics.info 63
https://twitter.com 19
http://librosweb.es 14
http://www.weinstrasse-webdesign.com 5
http://librosweb.dev 4
http://webcache.googleusercontent.com 4
http://eventifier.co 2
http://www.cytx-investor.com 1
http://ec2-54-243-189-159.compute-1.amazonaws.com 1
http://elearning.tadelformacion.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Joomla! Performance on Steroids Joomla! Performance on Steroids Presentation Transcript

  • JOOMLA! PERFORMANCEON STEROIDSTenko NikolovSiteGround CEOMarian Marinov1H CEO
  • DOUBLE SESSION
  • HOW TO MAKE YOUR JOOMLA LOADFASTERLevel: Beginner to intermediatePresented by: TenkoPART 1
  • SETUP JOOMLA FOR HIGH-PERFORMANCE(OR JOOMLA AND SERVER SIDE CACHING)Level: AdvancedPresented by: Tenko & MarianPART 2
  • Ask usquestionsatanytime!INTERACTIVE SESSIONS
  • A LITTLE BIT ABOUT US
  • Tenko’s Bio 17+ years of IT life 8 years with SiteGround 7 years CEO at SiteGround Takes care of 80,000+ Joomla!s Husband, dad Passionate about photography &geeky toys Addicted to cars and everythingfast
  • Marian’s Bio Sysadmin since 1996 CEO and Co-Founder of 1H Ltd. andmastermind behind 1H Hive Computer science teacher at SofiaUniversity since 2007 Coordinator of OpenFest (Bulgariasbiggest FOSS conference) since 2005 Regular speaker at FOSS conferencesin the Balkan region
  •  Devs/Sysadmins who love to ssh and do everything ontheir own – cloud/vps/dedicated server owners Large/high traffic Joomla websites owners Multiple Joomla websites owners Performance GeeksWHO CARES ABOUTPERFORMANCE?
  • EVERYONE!WHO SHOULD CARE?
  •  Site speed affects your Google Rankings! Keep readers/customers happy & paying Be able to handle more visitors Go green and save $$$ from serversWHY CARE ABOUTPERFORMANCE
  • Faster Joomla = OptimizationsKEEPCALMIT’S NOTROCKETSCIENCE
  • PART 1Let’s get the basicsdone
  •  Keep your Joomla! updated Choose extensions wisely Deactivate unused extensions, upgrade used Simplify your templates as much as possibleGENERAL GUIDELINES
  • Simple Front Page Is Better Fancy stuff – only if you really need it Remove unnecessary large images Use fewer internal/external links – addsitemap Avoid loading content from remote servers
  • APPLICATION LEVELOPTIMIZATIONS
  • Enable Compression Natively supported by Joomla! – no extensions needed Requires mod_gzip/deflate to be enabled on the serverSiteGlobalConfigurationServer
  • Enable Joomla! Cache Enable the “System – Cache” plugin
  • Enable Joomla! CacheSiteGlobalConfigurationSystemCacheSettings
  • Some .htaccess Magic Get the code:http://goo.gl/ze09B How it works:- Etag – Tells browsers that an image/unit does not need to bereloaded- Expires Headers – Set different expiration dates for various filetypes- AddOutputFilterByType DEFLATE – minifies the compiled HTMLsource code
  • Some .htaccess Magic The code:FileETag MTime SizeAddOutputFilterByType DEFLATE text/html text/css application/javascriptExpiresActive OnExpiresDefault "now plus 1 hour"ExpiresByType text/css "now plus 1 week“ExpiresByType application/javascript "now plus 1 week"ExpiresByType application/x-javascript "now plus 1 week”
  • More Optimizations: Images, CSS & JS Resize images – never upload 2560x1600 pictures Smush your images Minify and combine CSS and JS files Use image sprites
  • Sounds Nice, How Do I Begin? Use smush.it Photoshop/Fireworks Joomla! Extensions
  • Some Highly Rated Extensions JCH Optimize – Combines JS and CSS,Combines images in sprites, Minify and Compress Jbetolo – same as above but + CDN support JotCache – improves the Joomla! built in CoreCache Cache Cleaner – easily clean the cache from theJoomla! admin panel
  • JCH Optimize Enable the “System – JCH Optimize” plugin
  • JCH Optimize Settings
  • Google mod_pagespeed An open-source Apache module - compress,combine and cache Needs to be installed/configured by a SystemAdministrator Available on SiteGround servers
  • Check How’s Your Website Doing Google Page Speed Insights -http://goo.gl/zPkxx YSlow - http://goo.gl/qIios GTmetrix - http://gtmetrix.com/
  • Some tests – Default Joomla!No Optimizations Cache/Compression.htaccess rulesJCHPage LoadTime1.61s 1.49s 1.32s 1.02sTotal PageSize563KB 162KB 162KB 151KBNumber ofRequests35 35 35 19PageSpeedGradeF (41%) B (65%)B(87%)A(91%)YSlowGradeC (70%) B (66%)B(86%)A(92%)
  • SERVER LEVELOPTIMIZATIONS
  • YOUR VISITORSLOCATIONMATTERS!USE CDN
  • CDN Features CDN will make your website faster CDN will help avoid unneeded I/O on your harddrives CDN will appeal to both Google and your visitors
  • Opcode/Object Caching FastCGI + APC PHP extension Memcached and PHP/MySQL eAccelerator
  • Joomla Interaction with YourDatabase First request goes tothe database server
  • Object Caching First request goes tothe database server Objects are alsostored in Memcached
  • Object Caching All consecutiverequests areforwarded to theMemcached server
  • How PHP works Scanning Lexing Parsing Compilation Opcode Execution
  •  Opcode  ExecutionPHP Opcode Caching
  • Reverse Proxy Servers
  • Reverse Proxy Servers
  • Reverse Proxy Servers
  • Reverse Proxy Servers
  •  Custom PHP/MySQLconfiguration Memcached/PHP APC Joomla! friendly reverse proxysetupOur Own Solution: The SUPERCACHER
  • More tests: Joomla + VirtueMartNo OptimizationsApplication LevelOptimizationsServer LevelOptimizationsPage Load Time 5.22s 3.49s 1.09sTotal Page Size 1.89MB 0.67MB 0.67MBNumber ofRequests76 28 28Page SpeedGradeF (41%) B (85%) A (92%)YSlow Grade C (70%) B (84%) A (94%)
  • Some Key Takes from part 1Speed optimization is a process – do itregularly and you will be rewarded.Always test! Don’t test on a live site, usestaging copy instead! Backup!Choose a well optimized host
  • TAKE A BREAKback in 5!
  • PART 2Let’s get our handsdirty
  • Cloud, VPS or Dedicated?Cloud – can be both awfully slow and cheap or superfast and really expensive, highly scalableVPS – Usually fast and inexpensive, but you’redependent on others on the same box, limitedscalabilityDedicated – usually expensive and fast, not easilyscalableCHOOSING THE METAL
  • Hardware matters! SSD drives for MySQL & Cache SSD Capable File System, if dedicated RAID for files RAM for Caching CPUs that support virtualization BACKUP! BACKUP! BACKUP!
  • We need to install some software on it:1. Web Server2. MySQL3. PHP with Cache4. Memcached5. Static and Reverse Proxy serverNOW THAT YOU HAVE YOURBOX
  • Web server choiceWEB SERVER CHOICE
  • ★ Apache Pros Easy to setup and support, hundreds of modules,free Supports Joomla! out of the box Can be found on 99% of the webhosts preinstalledApache Cons Apache does not scale well and is resource heavy Apache has limited number of concurrent users Apache is generally much slower than NginX in everyaspectApache is the obvious choice.. Or is it?
  • Timeout 30KeepAliveTimeout 10MaxKeepAliveRequests 30StartServers 20MinSpareServers 10MaxSpareServers 20✔ Remove all unused apache modules, this reducesthe request processing time.Apache recommended settings
  • ★ NginX Pros Shorter response times compared to apache Very high number of concurrent users Faster than Apache in serving static content Supports FastCGINginX Cons Not supported by major control panels (cPanel, Plesk) Does not support mod_rewrite out of the box –additional configuration for Joomla!NginX for performance PHP
  • Joomla SEF URLs on NginXAdd this code to nginx.conf file:MORE INFO AT: http://is.gd/qCeuqU# Support Clean (aka Search Engine Friendly)URLs</tt>location / {try_files $uri $uri//index.php?q=$request_uri;}
  • BIND=/tmp/nginx.fcgi.sockUSER=apachePHP_FCGI_CHILDREN=20PHP_FCGI_MAX_REQUESTS=5000PHP_CGI=/usr/bin/php-cgiPHP_CGI_NAME=`basename $PHP_CGI`PHP_CGI_ARGS="- USER=$USER PATH=/usr/binPHP_FCGI_CHILDREN=$PHP_FCGI_CHILDRENPHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND"su - $USER -s /bin/bash -c "/usr/bin/env --$PHP_CGI_ARGS &"Setup NginX with FastCGI & PHP
  • 1. Most buffers in MySQL are per connection. Theystore pointers, NOT data.2. Optimize your InnoDB- separate the data files- increase innodb_thread_concurrency (not morethen the amount of cores you have)3. Optimize your query cache.MYSQL SETUP TIPS
  • Expected MySQL Qcache resultsQcache_hits | 61168 |Qcache_inserts | 10068 |Qcache_lowmem_prunes | 0 |Qcache_not_cached | 3 |Qcache_queries_in_cache | 922 |
  • LET’S MAKE PHP FLY
  • FastCGI SetupEnable FastCGI Apache Module FastCGI Wrapper ScriptLoadModule fcgid_modulemodules/mod_fcgid.so# Activate the PHP handling<IfModule mod_fcgid.c><Files ~ (.php)>SetHandler fcgid-scriptFCGIWrapper/var/www/users/wrapper/php-fcgi .phpOptions +ExecCGI</Files>FcgidMaxRequestLen 20000000</IfModule>Wrapper script/var/www/users/wrapper/php-fcgi#!/bin/shexport PHPRC=/etc/exportPHP_FCGI_MAX_REQUESTS=5000export PHP_FCGI_CHILDREN=20exec /usr/bin/php-cgi
  • 1. Install APC:pecl install apc2. Load APC extension in PHP:/usr/local/lib/php.ini - extension=apc.soRecommendation: Keep the default settings!Enable APC
  • Enable Memcached1. Install Memcached (service)yum install memcached2. Install PHP Memcached modulepecl install memcache3. Recommendation: configure Memcached to use Unixdomain socket instead of TCP – improves speed!/usr/bin/memcached -d -m 64 -c 2049 -P/var/run/memcached/memcached-11211.pid -s/tmp/memcache.sock
  • Enable APC/Memcached in Joomla
  • Joomla Patch for Unix Socket ConnectionsEdit the following file:libraries/joomla/cache/storage/memcache.phpChange the code on lines 86-88 fromself::$_db->addServer($server[host], $server[port], $this->_persistent);$memcachetest = @self::$_db->connect($server[host],$server[port]);To:self::$_db->addServer(unix:///tmp/memcache.sock, 0);$memcachetest = @self::$_db->connect(unix:///tmp/memcache.sock, 0);
  •  Move PHP binaries to RAM Move TMP to RAM Move MySQL to an SSD drive or SSD RAID array Enable MySQL query cache Use TMPFS for MySQL’s tmpdir Install Google PageSpeed for apache Enable Gzip compression (mod_deflate on apache2)More Apache/MySQL/PHP Tweaks
  • EVEN BETTERPERFORMANCE?
  •  Also known as Reverse HTTP Proxy Install it in front of any server that speaks HTTP Blazing fast – usually speeds up 300-1000x Performance is usually bound by the speed ofLAN Free, Open Source softwareVarnish - The ultimate web app accelerator
  •  Can be harder to setup and configure than NginX You still need Apache (or NginX, varnish does notknow PHP) Dramatic performance increase – only whencaching dynamic content Caching dynamic content might lead tounexpected troubles!!! Cache should be properlyinvalidated!!!Varnish Cons
  • Varnish VCL? Exclude non-cacheable pages:• registration form• administrator• installation folder Set objects expiration time
  • Sample Varnish Joomla VCLjoomla.vcl:# Bypass Varnish if the request is to the registration formif (req.url ~ "task=registration.register" || req.url ~ "view=registration") {return(pipe);}# Never cache administrator/installationif (req.url ~ "/administrator" || req.url ~ "/installation") {return (pass);}return (lookup);----sub vcl_recv {set req.backend = default;include "joomla.vcl";if (req.url ~ ".(png|gif|jpg|swf|css|js)([?].*)?$") {return (lookup);}
  • How we tested? We use Siege - http://www.joedog.org/siege-home/ Siege command: siege -b -t 60S -f urls.txt -c 20 We use 20 number of simultaneous connections We use a predefined list of URLs – all URLs fromthe default Joomla main page + sample data We measure the number of hits taken for 60secondsTEST THE OPTIMIZATIONS
  • Test Environment Setup• Virtual Machine (VPS)• CPU: 4 cores 2GHz• MEM: 4GB• HDD: 8x500GB SATA II 7,200rpm in RAID 10(on the host)
  • Joomla! Optimizations Test ResultsApache +fcgiApache +fcgi +MemcachedApache+ fcgi +APCApache +fcgi +NginXApache +fcgi +VarnishTransactions3,285 hits 4,316 hits 4,629hits185,462hits178,906 hitsAvailability 99.85% 99.83% 99.86 % 100.00% 100.00%Datatransferred9.20 MB 12.09 MB 12.97 MB 519.08 MB 500.29 MBResponsetime0.29 sec 0.18 sec 0.20 sec 0.01 sec 0.01 sec
  • QUESTIONS TIME
  • THANK YOU!Tenko Nikolovtenko@siteground.com@tnikolovMarian Marinovmm@1h.com