280 likes | 292 Vues
İ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.
E N D
İleri Seviyede Oracle Ön Bellek Mekanizması(OracleCoherence) Ahmet Fuat SUNGUR afsungur@gmail.com @afsungur 11.10.2012 – BahçeşehirUniversity
Who am i • Y.T.U – ComputerEngineering • I.T.U – ComputerEngineering, not completed • Since 2008, TurkcellTechnology afsungur@gmail.com @afsungur
Agenda • What is thecacheandbuffer? • Whyweusecachesin designingprogramming? • OracleCoherence • Features • Demos • Final
Buffer Memory • Abuffer is a region of a physical memory storage used to temporarily hold data while it is being moved from one place to another. • Itis a temporary memory location that is traditionally used because CPU instructions cannot directly address data stored in peripheral devices.
Caching • Acacheis a component that transparently stores data so that future requests for that data can be served faster.
Caching • CPU Cache • TLB ( TranslationLookasideBuffer ) • Disk Cache • Web Cache • DNS Cache
Cache in Programming APPLICATION request response response request DB
OracleCoherence • A variety of cachingstrategies • Reportingandadministratorsupportvia JMX andassociatedtools • RichlanguagesupportviaCoherence*Extend • Has nosinglepoint of failure • Automaticallyandtransparentlyfailsoverandredistributesitsclustered data managementsservices. • Automaticallyscaleupyourapplicationwhen a server added
What is Coherence Cluster Node • A Coherence Cluster node • Sometimesreferredto as a memberorclustermember • Is a javaprocess • Joins a cluster • Is an instance of Coherence server • Can contain data, runprocessingandserveevents • Is oftendefinedby a cacheconfiguration • localstorage.enabled = true => nodecontains 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 • WorkingGroupsandPrivateConversation • Deathdetection • FailedServers • Failover • Failback
CoherenceCacheTopologyExamples • LocalCache • ReplicatedCache JVM LocalCache JVM JVM JVM ReplicatedCache ReplicatedCache ReplicatedCache
CoherenceCacheTopologyExamples • PartitionedCache ( Distributed Cache ) • NearCache JVM JVM JVM PartitionedCache Back Front JVM JVM JVM LocalCache PartitionedCache
ReplicatedCacheAnimation Cache Data Grid Seamlesslygetallcache data and put into in itsowncache Add a customer 1,2 1,2 1,2 3 3 3
PartitonedCacheAnimation Cache Data Grid Add a customer 3 1 2
NearCacheAnimation Generally, LocalCache is used forfrontcache, because of ~0 cost returns 2 toapp Fromfrontcache returns 2 from backcacheand write it tofrontcache returns 1 from frontcache requests 1 from Front cache requests 2 from Front cache Front Cache 3 2 4 1 2 noneedtoaccess backcache it’sneedtoaccess backcache BackCache Generally, PartitionedCache is used forbackcache, because of accessing muchmore data. 3 4 1 2
NearCacheAnimation • NearCacheinvalidationstrategies • Listen None • Listen Present • Listen All • Listen Auto Updates 2 to Front cache Front Cache 3 2 4 1 2 BackCache 3 4 1 2
When data source is involved • Read-Through • Write-Through • Write-Behind • Refresh-AheadCaching
Write-BehindCaching • Improvesapplicationperformance • Reducesdatabaseload • Insulatedfromdatabasefailures • LinearScalibility
Refresh-Ahead • Twoparameters • Expiration time • Refresh-aheadfactor Expiration time:60 seconds RefreshAheadfactor :0.5 Request «1» @13:45:10 Database 48-10>60*05, Sononeedtoreload 24-15<60*05 Soweneedtoreload Getobject 2 fromdb put intothecache Request «2» @13:45:15 Gotfreshobjectfromdb ( obj 2 ) 13:46:15
EventandParallelProcessing • Coherencesupportstwo background processingmodels • ParallelProcessing • Events • Maplistenerswhicharecalledasynchronouslyafter data changes • Maptriggerswhicharecalledsynchronouslybefore data changes
QueriesandFilters • Coherencesupportstwoquerymechanism • A filtermechanism, usefulforeventsandeventfilters • MapEventFilter • AndFilter, OrFilter • … • A SQL-Likemechanismknown as theCoherence Query Language usefulforqueriesagainstcaches • SELECT result-set | * FROM cache-name WHERE conditional-expression • Select * fromcustomerswhere name like ‘%ap%’ • Select max(price) fromstockswherelastupdatedate • Select avg(price) fromstocks • Insert, update, delete…
Demo Time • Oracle Virtual Box 4.1 • Oracle Enterprise Linux • OEPE ( Oracle Enterprise PackageforEclipse ) • OracleCoherence 3.7.1
Other • Coherence Security • Coherence Management • Managingandmonitoringvia JMX • CoherenceReporter • Coherence*Extend • Coherence*Web