about the technology stack • hopefully gain new knowledge • critique and improve business guys: • speed up your website • rank higher in search engines • save big money • keep your customers happy
retail store chain • around 20.000 products • catalog and promotions updated many times a day • global stock - warehouse and around 80 physical shops • everything managed from the ERP
EE with FPC • Percona Server (MySQL) • Solr • Redis + Memcached • slow response times • extremely high CPU and RAM usage • index problems • services crashed • angry customers • etc.
a solution • research other FPCs • research other technologies • benchmark • proof of concept • monitor • external audit • hardware resources • tweak PHP-FPM • reconfigure network • no cache persistence • monitor • refactor code • optimize queries • block and container cache • FPC invalidation • remove unused features • research • cache more data
slow • big resource consumer Varnish • no SSL/TLS support • steep learning curve • still need a web server and an SSL terminator • researched VMOD’s not stable • existing Magento FPC extensions painful • selective invalidation too complex Approaches we didn’t like
and reliable Feature complete • all features of Magento CE and EE available • simple to add, extend and overwrite features Adaptable and scalable • easily adapt to existing architecture • scale the cache system Simple and straightforward • quick learning curve • developer friendly
POP3 and IMAP • Balancing with health checks and fault tolerance • Filters - gzip, chunked responses, XSLT, SSI, etc. • SSL and TLS support • SPDY, WebSockets and HTTP/2 support • Simultaneous connections and request limiting • Bandwidth throttling • Media streaming • Modular and scriptable: C, Perl, Lua, JavaScript Nginx is a web server with a strong focus on high concurrency, performance and low memory usage. It can also act as a reverse proxy server for HTTP, HTTPS, SMTP, POP3, and IMAP protocols, as well as a load balancer and an HTTP cache.
cached! Customer name, cart information and other small areas need to be injected. • Varnish has ESI (Edge Side Includes), Nginx has SSI (Server Side Includes) • Commands: block, config, echo, if/elseif/else, include and set <!--# include virtual="/remote/body.php?argument=value" -->
for tagging ❌ saves cache on disk ❌ needs NFS on multiple servers ❌ not cool for conditional cache purging ◦ gather every single URL for purging hole punches ❌ save one request but add more subrequests ❌ still consuming resources ❌ can be cached, but needs different backend ❌ lots of Nginx or Magento scripting
reverse proxy • minimal configuration Aggressive but consistent • cache pages and hole punches • same backend and same logic Simplified invalidation • invalidation for modified content only • tagging Familiarity • do as much as possible in Magento • customise according to your needs
status line • headers • body HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 Date: Thu, 30 Jul 2015 13:19:25 GMT <html> <body> <h1>Hello World!</h1> </body> </html> How to read and write the cache
the cache! • offers more control • configurable and extensible • familiar Mage_Core_Model_Cache • tagging support • easy invalidation • adapter for Redis and Memcached • write your own storage adapter
well written architecture • mostly event observer based • minimal configuration • full API documentation (phpDoc) • code strictly analysed by phpmd, phpcs and phpcpd • no introduced performance bottlenecks (blackfire.io) Nginx + Lua • sample VHost configuration ◦ regular web server and balancer ◦ reverse proxy and balancer • minimal configuration • Lua libraries and modules ◦ 3rd party libraries ◦ solution libraries and modules • full API documentation (LuaDoc)
Magento reports are fragmented ◦ if you’re still using them, there’s Google Analytics and Co. • The built-in sitemap generator does not provide full path URL’s ◦ if you rely on the sitemap for cache warm-up, get yourself a better generator • You may need to increase number of connections to Redis/Memcached