44
High Performance Websites With Multi-level Caching Quy Nguyen

High performance web sites with multilevel caching

Embed Size (px)

Citation preview

Page 1: High performance web sites with multilevel caching

High Performance Websites With Multi-level Caching Quy

Nguyen

Page 2: High performance web sites with multilevel caching

Overview• Bizweb Model• Bizweb Microservices Model• Frontend Caching• Assets Caching• API Caching• Content delivery network

Page 3: High performance web sites with multilevel caching

Bizweb ModelOne Platform, Every Channel, Any Device.

Page 4: High performance web sites with multilevel caching

Multi-Channel Commerce Platform• A single, simple to use back office• Powering all your sales channels• Everything integrated

Page 5: High performance web sites with multilevel caching
Page 6: High performance web sites with multilevel caching
Page 7: High performance web sites with multilevel caching
Page 8: High performance web sites with multilevel caching

Bizweb Microservices Model

Page 9: High performance web sites with multilevel caching

Looking back, old stack• First line of code written in 2007• Bizweb released Mar, 2010• 8 Versions upgraded• Microsoft full stack• Stop upgraded Dec, 2014

Page 10: High performance web sites with multilevel caching

10

Monolithic architecture

Page 11: High performance web sites with multilevel caching

System problems• Outdated technology

• Un-stable system, un-flexible

• Difficult to scale

• Web Forms View Engine:• Stateful: 60K template folders• IIS precompile is too slow

Page 12: High performance web sites with multilevel caching

12

Requirements• Minimum core functions

• Open API for third-party integration

• Only one business service for Web/API/Mobile

• New template engine

• Easy to scale (system scale, team scale)

• Only 6 month for development

Page 13: High performance web sites with multilevel caching

13

Microservices Model

Page 14: High performance web sites with multilevel caching

14

Advantages of microservices architecture• Each microservice is relatively small

• The IDE is faster making developers more productive• The web container starts faster, which makes developers more productive, and speeds up

deployments

• Each service can be developed and deployed independently

• Improves fault isolation

• Makes it easier for a new developer to understand the functionality of a service

• Easy to throw away

• Eliminates any long-term commitment to a technology stack

• Easy to scale

Page 15: High performance web sites with multilevel caching

Microservices drawbacks

• Deploying microservices can be complex

• Multiple databases and transaction management can be painful

• Testing a microservices-based application can be cumbersome

• Developing distributed systems can be complex

Page 16: High performance web sites with multilevel caching

16

ScaleFunctional Scaling

(Microservices)Team Scaling(Microservices)

Page 17: High performance web sites with multilevel caching

17

Current stack• ASP.NET MVC• C# / Java / Ruby / NodeJS• Spring Boot, Spring Cloud,

Spring Security, Spring Security OAuth• Netflix OSS: Zuul, Hystrix,

Turbine, Eureka, Ribbon, Feign• IIS / Jetty• Windows Server / Ubuntu

• dotLiquid• Resque• RabbitMQ, Kafka• Redis, MongoDB• Nginx• ElasticSearch• Cloud Service: Amazon EC2, S3,

Route53, DigitalOcean, VCCloud• Apache Traffic Server• Thumbor

Page 18: High performance web sites with multilevel caching

18

Bizweb Microservices Architecture

Page 19: High performance web sites with multilevel caching

Caching

Page 20: High performance web sites with multilevel caching

4 levels of caches• 1st: Network level cache: caching in the browser, CDN, and

proxies• 2nd: Application caching: An in-memory, per server cache

• 3rd: Distributed in-memory key-value store. Share cache elements across different servers that serve the same site• 4th: Database Caching. The entire database is cached in-

memory. The entire thing

Page 21: High performance web sites with multilevel caching

Frontend Caching

Page 22: High performance web sites with multilevel caching

Frontend Caching• Serve gzip content• ETag and 304 Not Modified for dynamic content• Generational caching• No explicit expiry

Page 23: High performance web sites with multilevel caching

Browser caching

Page 24: High performance web sites with multilevel caching

HTTP ETag

Page 25: High performance web sites with multilevel caching

HTTP Caching - ETag

Page 26: High performance web sites with multilevel caching

Frontend Distributed Caching

Page output caching.

Page 27: High performance web sites with multilevel caching

Frontend Distributed Caching• Full page caching• No explicit expiry (use LRU)• Redis• ETag cache key

Page 28: High performance web sites with multilevel caching

Generational caching

Page 29: High performance web sites with multilevel caching

Frontend caching

Page 30: High performance web sites with multilevel caching

Assets Caching

Page 31: High performance web sites with multilevel caching

Amazon S3Theme assets, images, files.

Page 32: High performance web sites with multilevel caching

Amazon S3• Easy to use

• Flexible

• Reliable

• Scalable and high-performance

• Secure

• Low cost

Page 33: High performance web sites with multilevel caching

Theme assets caching• Application in-memory caching • Redis• Explicit expiry

Page 34: High performance web sites with multilevel caching

Theme assets caching

Page 35: High performance web sites with multilevel caching

Theme assets caching

Page 36: High performance web sites with multilevel caching

API Caching

Page 37: High performance web sites with multilevel caching

API Caching• Cache full model objects in Redis• Cache invalidation messages• No explicit expiry

Page 38: High performance web sites with multilevel caching

API Caching

Page 39: High performance web sites with multilevel caching

Content Delivery Network

Page 40: High performance web sites with multilevel caching

Bizweb CDN• Apache Traffic Server• Thumbor• NodeJS sass compiler• Route53• Amazon EC2, VCCloud, DigitalOcean

Page 41: High performance web sites with multilevel caching

Bizweb CDN

Page 42: High performance web sites with multilevel caching

Bizweb Caching

Page 43: High performance web sites with multilevel caching

Bizweb Caching

Page 44: High performance web sites with multilevel caching

Q&A