deploying large scale webapps
play

Deploying Large Scale Webapps Thierry Sans Users respond to speed - PowerPoint PPT Presentation

Deploying Large Scale Webapps Thierry Sans Users respond to speed Amazon found every 100ms of latency cost them 1% in sales Google found an extra . 5 seconds in search page generation time dropped traffic by 20% A broker could


  1. Deploying Large Scale Webapps Thierry Sans

  2. Users respond to speed “Amazon found every 100ms of latency cost them 1% in sales” “Google found an extra . 5 seconds in search page generation time dropped traffic by 20%” “A broker could lose $4 million in revenues per millisecond if their electronic trading platform is 5 milliseconds behind the competition” http://blog.gigaspaces.com/amazon-found-every-100ms-of-latency-cost-them-1-in-sales/

  3. How to serve millions Optimizing frontend code with HTTP/2, Web Workers and PWA (Progressive Web Apps) Optimizing backend code with web caching Optimizing the infrastructure with microservices

  4. Current situation (dedicated or virtual server) Static Files Web App Two types of content • Static content : html, css, js, images and so on • Dynamic content : database, uploaded files

  5. Optimizing the backend code with Web Caching

  6. How to improve response time? Processing the request means: DB and API accesses are expensive 1. Parse the HTTP request (time and money when your host charges you each access) 2. Map the URL to the handler 3. Query the database or third-party API 4. Compute the view

  7. Fine-grained caching with the web application (for dynamic content) Static Files Web App Memory Cache Cache controlled by the program ๏ Specific for each app ✓ Good for dynamic content ➡ Popular memory cache: Memcached

  8. Distributed Shared Cache : Memcached http://memcached.org/ • Store key/value pairs in memory • Throw away data that is the least recently used

  9. A typical cache algorithm retrieve from cache if data not in cache: # cache miss query the database or API update the cache return result

  10. Cache Stampede (a.k.a dog piling) Web App cache miss! Cache Problem: Multiple concurrent requests doing the same request because cache was cleared Solution: • update the cache instead of clearing it after an insert • a page view will never query the database ➡ Requires cache warming

  11. Optimizing the infrastructure with microservices

  12. The reverse proxy architecture Static Web Server static files Reverse Web App Proxy Certificate Memory Cache Manager certficate Cache repeated HTTP requests for a given time ๏ Bad for dynamic content (latency when the content is updated) ✓ Good for static content (Javascript, CSS, Media, static HTML)

  13. Microservices via Docker Containers Static Web Static Files Server Reverse Web App Proxy Certificate Memory Cache Manager

  14. Scaling over multiple servers

  15. Serving multiple apps with a load balancer Static Server Web App Memcached Web App Load Balancer Memcached … Cert Manager Web App Memcached This is not an efficient cache

  16. Distributed Shared Cache Static Server Web App Web App Load Balancer … Cert Manager Web App … Memcached Memcached Memcached

  17. Database Sharding Static Server Web App Web App Load Balancer … … Cert Manager Web App … Memcached Memcached Memcached

  18. Microservices over several physical machines Static Server Web App Web App … Load Balancer … Web App Cert Manager Memcached … Memcached Memcached Container Orchestrator (like Kubernetes or Docker Swarm) . . .

  19. CDN : Content Distribution Network edge server CDN Example : Akamai, Cloudflare

  20. High-Performance Software Reverse proxy Static Web Server Nginx Load Balancer Certificate Manager Memory Cache Memcached / Redis Container Docker Container Orchestration Kubernetes / Docker Swarm

Recommend


More recommend