Ahmet Fuat – Bahçe ş ehir University İleri Seviyede Oracle Ön Bellek Mekanizması (Oracle Coherence)
Who am i Y.T.U – Computer Engineering I.T.U – Computer Engineering, not completed Since 2008, Turkcell
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 EMP_IDNAMETEL_NO ADDRESSGENDER İ stM İ stanbulM İ stanbul M DB EMP_IDNAMETEL_NOGENDER 1Ahmet531232M 3Hasan855412M request response responseresponse requestrequest
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 Replicated Cache JVM Local Cache JVM Replicated Cache JVM Replicated Cache JVM Replicated Cache
Coherence Cache Topology Examples Partitioned Cache ( Distributed Cache ) Near Cache JVM Partitioned Cache JVM Local Cache JVM Partitioned Cache
Replicated Cache Animation CUST_IDNAMETEL_NO 1Ahmet Sungur Ay ş e Öz ,2 Add a customer 3Mehmet Akar ,2 3 Seamlessly get all cache data and put into in its own cache
Partitoned Cache Animation CUST_IDNAMETEL_NO 1Ahmet Sungur Ay ş e Öz Add a customer 3Mehmet Akar
Near Cache Animation requests 1 from Front cache returns 1 from front cache no need to access back cache 34 requests 2 from Front cache it’s need to access back cache returns 2 from back cache and write it to front cache 2 returns 2 to app From front cache Generally, Local Cache is used for front cache, because of ~0 cost Generally, Partitioned Cache is used for back cache, because of accessing much more data.
Near Cache Animation Updates 2 to Front cache 2 Near Cache invalidation strategies Listen None Listen Present Listen All Listen Auto
Failover
When data source is involved Read-Through Write-Through Write-Behind Refresh-Ahead Caching
Read Through Caching
Write Through Caching
Write-Behind Caching Improves application performance Reduces database load Insulated from database failures Linear Scalibility
Refresh-Ahead Two parameters Expiration time Refresh-ahead factor Expiration time:60 seconds Refresh Ahead factor :0.5 Database CUST_IDNAMETEL_NOEXPIRATI ON_TIME 1Ahmet Sungur :45:48 2Ay ş e Öz :45:24 Request 48-10>60*05, So no need to reload Request 24-15<60*05 So we need to reload Get object 2 from db put into the cache Got fresh object from db ( obj 2 ) 13:46:15
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 MapEventFilter AndFilter, OrFilter … 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 lastupdatedate 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