Upload
dotnet-open-group
View
65
Download
2
Embed Size (px)
Citation preview
High Performance Websites With Multi-level Caching Quy
Nguyen
Overview• Bizweb Model• Bizweb Microservices Model• Frontend Caching• Assets Caching• API Caching• Content delivery network
Bizweb ModelOne Platform, Every Channel, Any Device.
Multi-Channel Commerce Platform• A single, simple to use back office• Powering all your sales channels• Everything integrated
Bizweb Microservices Model
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
10
Monolithic architecture
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
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
13
Microservices Model
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
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
16
ScaleFunctional Scaling
(Microservices)Team Scaling(Microservices)
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
18
Bizweb Microservices Architecture
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
Frontend Caching
Frontend Caching• Serve gzip content• ETag and 304 Not Modified for dynamic content• Generational caching• No explicit expiry
Browser caching
HTTP ETag
HTTP Caching - ETag
Frontend Distributed Caching
Page output caching.
Frontend Distributed Caching• Full page caching• No explicit expiry (use LRU)• Redis• ETag cache key
Generational caching
Frontend caching
Assets Caching
Amazon S3Theme assets, images, files.
Amazon S3• Easy to use
• Flexible
• Reliable
• Scalable and high-performance
• Secure
• Low cost
Theme assets caching• Application in-memory caching • Redis• Explicit expiry
Theme assets caching
Theme assets caching
API Caching
API Caching• Cache full model objects in Redis• Cache invalidation messages• No explicit expiry
API Caching
Content Delivery Network
Bizweb CDN• Apache Traffic Server• Thumbor• NodeJS sass compiler• Route53• Amazon EC2, VCCloud, DigitalOcean
Bizweb CDN
Bizweb Caching
Bizweb Caching
Q&A