The document discusses using caching and queues to optimize web applications for performance and scalability. It presents techniques for implementing caching using Redis to improve response times and handle more concurrent users. It also discusses using queues like Amazon SQS to offload and distribute database writes for better availability and ability to scale. The document provides examples of benchmarking caching performance and a demo of using queues.
2. Executive Summary
• The objective of this presentation is fundamental web
development method using the cache.
• Optimization code to reduce resource cost and make
website faster.
• Amazon Web Services for Cache and Queue
2014-07-24 High-Availability: cache and queue
3. Outline
• Cache
• Simple example & Benchmark
• Queue & Write behind
• Simple worker demo
• Amazon Web Services for Cache and Queue
• Scalability
2014-07-24 High-Availability: cache and queue
4. Caching
• Cache can help reduce database loads.
• Instead of going to the database, data can be loaded from
in-memory cache
• Times faster than database.
2014-07-24 High-Availability: cache and queue
12. Conclusion
- Too many connections (>32)
- To increase max connections need larger RDS
Cache helps:
● Save money
● More concurrent user
● Faster delivery
2014-07-24 High-Availability: cache and queue
13. What could be cached?
• Database query
• Variable & Object
• View page & Template
• API
2014-07-24 High-Availability: cache and queue
14. Redis is more than cache
• It's a "NoSQL" key-value data stores
• It's a data structures server
Applications: Counting stuff, Pub/Sub, Queues, Real time
analysis, Leaderboards and related problems ...
2014-07-24 High-Availability: cache and queue
15. Queue & Write-Behind
● Offload database writes
● Spread writes out to flatten peaks
● Consolidate multiple writes into fewer database writes
● Being disconnected from the DB will let the frontend keep
running if the DB is down!
2014-07-24 High-Availability: cache and queue
21. Amazon Simple Queue Service
• Runs within Amazon’s high-availability data centers
• All messages are stored redundantly across multiple
servers and data centers
• Unlimited number of services to read and write
• Unlimited number of messages at any time
• Inexpensive
2014-07-24 High-Availability: cache and queue