Orange developers day-Application Caching
-
Upload
gamal-shaban -
Category
Education
-
view
245 -
download
1
description
Transcript of Orange developers day-Application Caching
![Page 1: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/1.jpg)
Web Application Caching
DB ORM Caching
Gamal ShaabanInternational CentersOrange Labs P&S CairoMobile Applications & Software Development
![Page 2: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/2.jpg)
Agenda
• Why Caching– The Theory of Caching
• ORM Caching– 1st Level of Caching– 2nd Level of Caching– Query Caching
![Page 3: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/3.jpg)
Why Caching?
![Page 4: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/4.jpg)
How much faster will caching make an application?
Why Caching
![Page 5: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/5.jpg)
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.
Why Caching
![Page 6: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/6.jpg)
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)
Why Caching
![Page 7: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/7.jpg)
Speed up from a Web Page CacheUn-cached page time: 2 secondsCache retrieval time: 2msProportion: 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
Why Caching
![Page 8: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/8.jpg)
Speed up from a Database Level CacheUn-cached page time: 2 secondsDatabase time: 1.5 secondsCache retrieval time: 2msProportion: 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
Why Caching
![Page 9: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/9.jpg)
Non-uniform distribution
Why Caching
![Page 10: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/10.jpg)
ORM Caching
![Page 11: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/11.jpg)
ORM Caching
1st Level CacheSession Caching:– Enabled by default.– Used transparently during the session.– All objects that was saved or retrieved• save• get• list
![Page 12: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/12.jpg)
ORM Caching
1st Level CacheSession Caching:– flush() - will sync cache to DB.– clear() - will evict all objects.
![Page 13: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/13.jpg)
2nd Level Caching
ORM Caching
![Page 14: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/14.jpg)
2nd Level Caching
ORM Caching
![Page 15: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/15.jpg)
Cache Providers• EhCache.• OSCache.• JBoss Cache (AKA Infinispan).• WarmCache.• Hazelcast.• Oracle Coherence.• Gigaspaces.• GemFire
ORM Caching
![Page 16: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/16.jpg)
Caching Strategies
• Read-only• Read-write• Transactional• Nonstrict-read-write
ORM Caching
![Page 17: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/17.jpg)
Caching Types
• Memory Caching• Disk stores• Clustered (distributed Caching)• Server Caching (RESTful cache server).
ORM Caching
![Page 18: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/18.jpg)
Questions ?
![Page 19: Orange developers day-Application Caching](https://reader033.fdocuments.us/reader033/viewer/2022052619/555c25abd8b42a0b418b4c9a/html5/thumbnails/19.jpg)
Thank You