leri Seviyede Oracle n Bellek Mekanizmas Oracle Coherence
İleri Seviyede Oracle Ön Bellek Mekanizması (Oracle Coherence) Ahmet Fuat SUNGUR afsungur@gmail. com @afsungur 11. 10. 2012 – Bahçeşehir University
Who am i �Y. T. U – Computer Engineering �I. T. U – Computer Engineering, not completed �Since 2008, Turkcell Technology afsungur@gmail. com @afsungur
Agenda § What is the cache and buffer? § Why we use caches in designing programming? § Oracle Coherence § Features § Demos § Final
Buffer Memory § A buffer is a region of a physical memory storage used to temporarily hold data while it is being moved from one place to another. § It is a temporary memory location that is traditionally used because CPU instructions cannot directly address data stored in peripheral devices.
Caching § A cache is a component that transparently stores data so that future requests for that data can be served faster.
Caching § CPU Cache § TLB ( Translation Lookaside Buffer ) § Disk Cache § Web Cache § DNS Cache
Cache in Programming APPLICATION request EMP_ID NAME TEL_NO GENDE R response 1 Ahmet 531232 M 3 Hasan 855412 M r e s p o n s e DB r e q u e s t EMP_ID NAME TEL_NO EMAIL ADDRESS GENDE R 1 Ahmet 531232 afsungur@gmail. c om Bahçelievler/İst M 2 Aysel 895244 aysel@hotmail. co m Çankaya/Ankara F 3 Hasan 855412 hasan@outlook. co m Levent/İstanbul M 4 Veli 789621 veli@msn. com Sarıyer/ M
Oracle Coherence § A variety of caching strategies § Reporting and administrator support via JMX and § § associated tools Rich language support via Coherence*Extend Has no single point of failure Automatically and transparently fails over and redistributes its clustered data managements services. Automatically scale up your application when a server added
What is Coherence Cluster Node § A Coherence Cluster node § Sometimes referred to as a member or cluster member § Is a java process § Joins a cluster § Is an instance of Coherence server § Can contain data, run processing and serve events § Is often defined by a cache configuration § localstorage. enabled = true => node contains data JVM 1 PID : 5654 NODE 1 JVM 2 PID : 5655 NODE 2 JVM 3 PID : 5656 NODE 3
Clustering in Coherence § Using a conference room model § -Dtangosol. coherence. cluster=name § Listening § Discovery § Working Groups and Private Conversation § Death detection § Failed Servers § Failover § Failback
Coherence Cache Topology Examples § Local Cache JVM Local Cache § Replicated Cache JVM Replicate d. Cache
Coherence Cache Topology Examples § Partitioned Cache ( Distributed Cache ) JVM JVM Partitioned Cache § Near Cache JVM Local Cache JVM Partitioned Cache
Replicated Cache Animation CUST_ID NAME TEL_NO 1 Ahmet Sungur 530111223 3 2 Ayşe Öz 3 Mehmet Akar 532111224 4 534123456 1 Seamlessly get all cache data and put into in its own cache Add a customer 1, 2 3
Partitoned Cache Animation CUST_ID NAME TEL_NO 1 Ahmet Sungur 530111223 3 2 Ayşe Öz 3 Mehmet Akar 532111224 4 534123456 1 Add a customer 3 1 2
Near Cache Animation requests 2 returns 1 from requests 1 returns 2 to app from Front cache From front cache 3 4 2 1 2 no need to access returns 2 from it’s need to access back cache and write it to front cache 1 2 3 4 Generally, Local Cache is used for front cache, because of ~0 cost Generally, Partitioned Cache is us for back cache, because of accessing much more data.
Near Cache Animation Near Cache invalidation strategies Ø Listen None Updates 2 to Front cacheØ Listen Present Ø Listen All 3 4 2 Ø Listen Auto 1 2 3 4
Failover
When data source is involved �Read-Through �Write-Behind �Refresh-Ahead Caching
Read Through Caching
Write Through Caching
Write-Behind Caching Ø Ø Improves application perform Reduces database load Insulated from database failu Linear Scalibility
Refresh-Ahead �Two parameters �Expiration time �Refresh-ahead factor Expiration time: 60 seconds Refresh Ahead factor : 0. 5 Request « 1» @13: 45: 10 CUST_ID NAME TEL_NO EXPIRA TION_TI ME 48 -10>60*05, So no need to reload 1 Request « 2» @13: 45: 15 Ahmet Sungur 53011122 33 13: 45: 4 8 2 Ayşe Öz 53211122 44 13: 45: 2 4 Got fresh object from db ( obj 2 ) 13: 46: 15 24 -15<60*05 So we need to reload Get object 2 from db put into the cache Databa se
Event and Parallel Processing § Coherence supports two background processing models § Parallel Processing § Events § Map listeners which are called asynchronously after data changes § Map triggers which are called synchronously before data changes
Queries and Filters § Coherence supports two query mechanism § A filter mechanism, useful for events and event filters § Map. Event. Filter § And. Filter, Or. Filter § … § A SQL-Like mechanism known as the Coherence Query Language useful for queries against caches § SELECT result-set | * FROM cache-name WHERE § § conditional-expression Select * from customers where name like ‘%ap%’ Select max(price) from stocks where lastupdate Select avg(price) from stocks Insert, update, delete…
Demo Time �Oracle Virtual Box 4. 1 �Oracle Enterprise Linux �OEPE ( Oracle Enterprise Package for Eclipse ) �Oracle Coherence 3. 7. 1
Other �Coherence Security �Coherence Management �Managing and monitoring via JMX �Coherence Reporter �Coherence*Extend �Coherence*Web
Summary
- Slides: 28