Web Application
Caching
DB ORM Caching
Gamal Shaaban
International Centers
Orange Labs P&S Cairo
Mobile Applications & Sof...
Agenda
• Why Caching
– The Theory of Caching

• ORM Caching
– 1st Level of Caching
– 2nd Level of Caching
– Query Caching
Why Caching?
Why Caching

How much faster will caching make an
application?
Why Caching
It depends on a multitude of factors being:
• how many times a cached piece of data can and is
reused by the a...
Why Caching
Amdahl's Law & How to calculate entire system
speed up.
• Amdahl's law, after Gene Amdahl, is used to
find the...
Why Caching
Speed up from a Web Page Cache
Un-cached page time: 2 seconds
Cache retrieval time: 2ms
Proportion: 100%
The e...
Why Caching
Speed up from a Database Level Cache
Un-cached page time: 2 seconds
Database time: 1.5 seconds
Cache retrieval...
Why Caching
Non-uniform distribution
ORM Caching
ORM Caching
1st Level Cache
Session Caching:
– Enabled by default.
– Used transparently during the session.
– All objects ...
ORM Caching
1st Level Cache
Session Caching:
– flush() - will sync cache to DB.
– clear() - will evict all objects.
ORM Caching
2nd Level Caching
ORM Caching
2nd Level Caching
ORM Caching
Cache Providers
•
•
•
•
•
•
•
•

EhCache.
OSCache.
JBoss Cache (AKA Infinispan).
WarmCache.
Hazelcast.
Oracle ...
ORM Caching
Caching Strategies
•
•
•
•

Read-only
Read-write
Transactional
Nonstrict-read-write
ORM Caching
Caching Types
•
•
•
•

Memory Caching
Disk stores
Clustered (distributed Caching)
Server Caching (RESTful cach...
Questions ?
Thank You
Upcoming SlideShare
Loading in...5
×

Orange developers day-Application Caching

286

Published on

Web Development, Web application caching techniques.

Published in: Education, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
286
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
5
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • Read-only: A concurrency strategy suitable for data which never changes. Use it for reference data only.Read-write: Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent transactions, in the rare case of an update.Transactional: Again use this strategy for read-mostly data where it is critical to prevent stale data in concurrent transactions, in the rare case of an update.Nonstrict-read-write: This strategy makes no guarantee of consistency between the cache and the database. Use this strategy if data hardly ever changes and a small likelihood of stale data is not of critical concern.
  • GimFire server cache & Spring data integration.
  • Orange developers day-Application Caching

    1. 1. Web Application Caching DB ORM Caching Gamal Shaaban International Centers Orange Labs P&S Cairo Mobile Applications & Software Development
    2. 2. Agenda • Why Caching – The Theory of Caching • ORM Caching – 1st Level of Caching – 2nd Level of Caching – Query Caching
    3. 3. Why Caching?
    4. 4. Why Caching How much faster will caching make an application?
    5. 5. Why Caching It depends on a multitude of factors being: • how many times a cached piece of data can and is reused by the application. • the proportion of the response time that is alleviated by caching. • In applications that are I/O bound, which is most business applications, most of the response time is getting data from a database. Therefore the speed up mostly depends on how much reuse a piece of data gets.
    6. 6. Why Caching Amdahl's Law & How to calculate entire system speed up. • Amdahl's law, after Gene Amdahl, is used to find the system speed up from a speed up in part of the system. 1/ ((1 - Proportion Sped Up) + Proportion Sped Up / Speed up)
    7. 7. Why Caching Speed up from a Web Page Cache Un-cached page time: 2 seconds Cache retrieval time: 2ms Proportion: 100% The expected server side system speedup is: 1 / ((1 - 1) + 1 / 1000) = 1 / (0 + .001) = 1000 times system speedup The to the browser “system” speed up is much less
    8. 8. Why Caching Speed up from a Database Level Cache Un-cached page time: 2 seconds Database time: 1.5 seconds Cache retrieval time: 2ms Proportion: 75% (1.5/2) The expected server side system speedup is: 1 / ((1 - .75) + .75 / (1500/2))) = 1 / (.25 + .75/750) = 3.98 times system speedup The to the browser “system” speed up is much less
    9. 9. Why Caching Non-uniform distribution
    10. 10. ORM Caching
    11. 11. ORM Caching 1st Level Cache Session Caching: – Enabled by default. – Used transparently during the session. – All objects that was saved or retrieved • save • get • list
    12. 12. ORM Caching 1st Level Cache Session Caching: – flush() - will sync cache to DB. – clear() - will evict all objects.
    13. 13. ORM Caching 2nd Level Caching
    14. 14. ORM Caching 2nd Level Caching
    15. 15. ORM Caching Cache Providers • • • • • • • • EhCache. OSCache. JBoss Cache (AKA Infinispan). WarmCache. Hazelcast. Oracle Coherence. Gigaspaces. GemFire
    16. 16. ORM Caching Caching Strategies • • • • Read-only Read-write Transactional Nonstrict-read-write
    17. 17. ORM Caching Caching Types • • • • Memory Caching Disk stores Clustered (distributed Caching) Server Caching (RESTful cache server).
    18. 18. Questions ?
    19. 19. Thank You
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×