Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WordPress Greek Community - FOSSCOM 2015 - Website optimisation - Takis Bouyouris

WordPress Greek Community - FOSSCOM 2015 - Website optimisation - Takis Bouyouris

WordPress Greek Community

November 07, 2015
Tweet

More Decks by WordPress Greek Community

Other Decks in Programming

Transcript

  1. Who am I? Takis Bouyouris Software Engineer Web Developer Co-founder

    @ Nevma WordPress Greek Community Hello World!
  2. 3. Google says so Speed is a SEO ranking factor

    because it is good for the users! Webmaster Central Blog: http://googlewebmastercentral.blogspot.gr/2010/04/using-site-speed-in-web-search-ranking.html
  3. Good performance requires: The completion of a request in a

    fast -or perceived fast- timeframe, with a reliable and predictable outcome.
  4. Websites live on HTTP requests Phases in every HTTP request

    1 – Browser 2 – Network 3 – Server 4 – Network 5 – Browser
  5. In order to optimise a website you need to optimise

    all three: 1 – Server side 2 – Network layer 3 – Browser side
  6. Server Performance Operating System File system Database layer Web server

    Application layer (more of a system admin's job)
  7. Network performance DSL, ADSL, VDSL 2G, 3G, 4G, HSDPA WiFi,

    Ethernet (cannot do much about that in HTTP)
  8. First, we need a tool to measure website performance All

    modern browsers have Developer Tools with a Network tab!
  9. But the best way is via an online service which

    - is objective - has stable conditions - provides good metrics
  10. Why Webpagetest.org - Real machines - Real browsers - Simulated

    networks - Stable, uniform conditions - Cities, devices, options - Open source
  11. First keep server side healthy - Secure your OS -

    Perform regular updates on OS, app server, db server - Keep as less files as possible especially images, even gifs - Database garbage cleanups - Database tables optimisation
  12. Also, server side - Allow HTTP keep-alive - Enable GZIP

    for texts - Avoid 404 requests - Use multiple domains - Avoid redirects
  13. WordPress specific tips - Delete old post revisions - Delete

    auto drafts - Delete spam comments - Delete unused terms - Set revisions not too often - Set number of revisions low - Use few custom image sizes - Cleanup old sticky posts - Delete orphaned post meta - Avoid frequent hooks and filters like "pre_get_posts" - Avoid long taxonomy "not-ins" - Remove unused plugins - Remove unused themes
  14. Then keep your codebase clean - Write quality code which

    is fast and maintainable - Choose quality addons themes, plugins, etc - Test early, test often aaand - WRITE QUALITY CODE!
  15. Assuming your web server is not too slow and the

    network is not holding you back...
  16. Rule No 1 again Seriously Make as FEW and QUICK

    HTTP requests as POSSIBLE! GIF on the right is there just to draw your attention Did it?
  17. Put CSS in the HEAD - Is downloaded asynchronously -

    Helps browsers start rendering page as often as possible * Except for "critical" CSS
  18. Put JS before BODY end - Because Javascript is "blocking"

    - Helps browsers start rendering page as early as possible
  19. Everyone will tell you to minify HTML too, but honestly,

    it won't make much of a difference!
  20. Compress images - Think of mobile devices, too - JPEG

    should be preferred - JPEG sizes can be reduced a lot - PNG sizes can be reduced a lot - WebP, the new kid on the block (Many tools online for this)
  21. Use image sprites - Combines many images into one -

    Smaller file sizes - Less HTTP requests
  22. Use SVGs - Scalable vector graphics - One file, one

    download - Scales at any size But, be careful, too many of them can slow down your browser!
  23. Cache on the server - Cache whole requests - Use

    object cache - Use query cache - HTML fragment caching - Opcode caching
  24. Cache on the browser Add expires headers Favicons -almost- never

    change Font files -almost- never change Styles and scripts rarely change Images also very rarely change HTML might change (but it depends) Be prepared to un-cache (invalidate) content
  25. Use a caching server like Varnish and/or a CDN not

    because it's fast, but because it is distributed
  26. "Edgy" hipster stuff - SPDY, HTTP2, HTTPS - Page prefetching

    - DNS prefetching - Async and defer in SCRIPTs (Google them)
  27. Just remember this: Try to make as few HTTP requests

    as possible and cache as much as you can ...and you 'll be half way there!