Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Coherence For Extreme Performance, Availablity and Scalability

952 views

Published on

Presentation given at UK OUG Tech conference December 2011.

Published in: Technology, Business
  • Be the first to like this

Coherence For Extreme Performance, Availablity and Scalability

  1. 1. Oracle Coherence for Extreme Performance, Scalability and Availability Steve Millidge Director C2B2 © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  2. 2. “Reliability, Availability, Scalability and Performance are prerequisites for functionality!”They are Priority 1 Requirements © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  3. 3. Availability• System is available for customers to use• No availability results in no transactions• Transactions = $$$• Receive your Pink Slip if you can’t sort it! © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  4. 4. Multipliers in Availability System System System 1 2 3 99% Availability 99% Availability 99% AvailabilityOverall Availability = 0.99*0.99*0.99 = 97% © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  5. 5. HA Techniques Redundancy Decoupling 99% Availability System System 99% Availability 1 99% Availability 99% Availability System System 2Pair = 1 – (0.01*0.01) = 99.99% System 99% Availability 3Overall = 0.9999 x 0.9999 x 0.9999 = 99% Overall = 99% © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  6. 6. Performance How fast does a single transaction take to execute!• Faster Performance = Happier Customers• Faster Performance = More Transactions © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  7. 7. Barriers to Performance• Raw Algorithmic Performance• Resource Limitations – Not enough cpu, disk, memory• Resource Contention – Locks• IO Latency – Network, Disk © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  8. 8. LatencyTime delay in requesting an operation and it being initiated• Key factor in large scale distributed applications• Typically not taken into account during development © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  9. 9. Latency Factors• Network Distance• Network Reliability• Data Size• Operation Granularity• Resource Contention• JVM GC © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  10. 10. Move the Data and Processing Close Together © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  11. 11. ScalabilityAbility to add more hardware in response to more demand. Without a reduction in performance! © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  12. 12. Business Imperatives• Success of the Business or Service• Growth of Mobile• Huge Variation of Load through a period• Sudden Large Spikes due to events Cloud Enables Elastic Scalability © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  13. 13. Scaling Out Horizontal Scaling• Add Additional Servers• Add Load Balancer• Distribute traffic across the servers• Much Cheaper than Scale Up• Has HA benefits © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  14. 14. Linear Scalability (Nirvana) 900 800 700 600 500Users Linear Scalability 400 Typical Scalability 300 200 100 0 1 2 3 4 Cluster Nodes © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  15. 15. Typical Scale Out Architecture Load BalancerNodes HostStateless Services Node Node Node Node 1 2 3 4 Database contains Database Persistent State © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  16. 16. Stateless ServicesTrue Stateless Services Pseudo Stateless• Static HTML Serving • Read, Update and Store• Basic Calculations state in the DB• State Received from • Use sticky session to Client route to non critical state • Typical of Most Online applications • Push scalability issue to the database © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  17. 17. Scaling a Stateless Middletier is easy howeverScaling Databases is hard and very expensive © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  18. 18. Radical IdeaPut state back into the Middleware © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  19. 19. Caching© C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  20. 20. Read Through Cache GET AApplication Cache A Cache Loader Data StoreA © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  21. 21. Write Through Cache GET B B PUTApplication Cache B Cache Writer Data Store © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  22. 22. Write Behind Cache GET B B PUTApplication Cache B Write Behind Processor Data Store © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  23. 23. Caches• Caches aren’t New – Hibernate Session Cache – Entity Bean Cache – JPA Cache – Custom Caches – Open Source Caches• Typically Cache Database Data or Page Fragments © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  24. 24. Local Caching (Roll your Own)Benefits Challenges• Pretty Simple to Write • Cache Eviction – Concurrent Hashmap • Cache Loading/Storing• Used in many • Cache Prefetching applications • Cache Refresh• Use JCache API • Write Behind Processing • Clustering !! THINK LONG AND HARD!! © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  25. 25. Clustering Challenges GET B GET BApplication Application Cache Cache B B DataB Store © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  26. 26. Update Replication UPDATE B B2Application Application Cache B2 B1 Cache B1 Data Store © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  27. 27. Update Invalidation UPDATE B B2Application Application Cache B1 B2 Invalidate Cache B1 Data Store © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  28. 28. Replication Write Performance B PUT BApplication Application Application Application Cache Cache Cache Cache B © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  29. 29. Cache Partitioning GET B PUT C B PUT BApplication Application C Application Application Cache Cache Cache Cache B C B © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  30. 30. Elasticity in Partitioned Caches Application Application Cache Cache © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  31. 31. HA Cache Partitioning B PUT BApplication Application Application Application Cache Cache Cache Cache NODE B CRASH !!! © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  32. 32. Partitioned Cache• Linear Scalability – 2 hops for Read (Worst Case) – 2 hops for Write (Worst Case)• High Availability – Configurable Duplicates• Location Independent Access – Grid knows where data is• More Nodes = More Data in Memory © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  33. 33. Consider a Large CacheApplication Application Application Application Application Application Application Cache Cache Cache Cache Cache Cache CacheApplication Application Application Application Application Application Application Cache Cache Cache Cache Cache Cache CacheApplication Application Application Application Application Application Application Cache Cache Cache Cache Cache Cache Cache © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  34. 34. How Much Can We Store• 21 Amazon xLargeMemory Instances – 17Gb RAM• 3 Nodes Per Instance – 4Gb 64bit JVM Heap + 5 Gb OS• 63 Cluster Nodes• 252 Gb JVM Heap Available• Approx 125Gb Data in the Coherence• Cost per Month $9000 © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  35. 35. Coherence can Even OverflowApplication • Passivates Data to a Local Cache Backing Store (NIO memory mapped file) • Use Java NIO for Off Heap Storage • Berkely DB local Storage Local Drive •Elastic Data (Journaled SSD Store) © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  36. 36. HA In Memory DataData Centre Server Rack 1 Server Rack 2 Application Application Application Application Application Application Cache Cache Cache Cache Cache Cache Data Centre Do We Need the Server Rack 1 Database? 2 Server Rack Applicati Applicati Applicati Applicati Applicati Applicati on Cache on Cache on Cache on Cache on Cache on Cache © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  37. 37. Database as Business Audit Applicati Applicati Applicati Applicati Applicati Applicati Applicati Cach on Cach on Cach on Cach on Cach on Cach on Cach on e e e e e e e Applicati Applicati Applicati Applicati Applicati Applicati Applicati Cach on Cach on Cach on Cach on Cach on Cach on Cach on e e e e e e e Applicati Applicati Applicati Applicati Applicati Applicati Applicati Cach on Cach on Cach on Cach on Cach on Cach on Cach on e e e e e e e Business Audit Data Data Store © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  38. 38. Now you Have a DATA GRID © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  39. 39. So Much More than an L2 Cache © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  40. 40. Computation on CoherenceApplication Application Application Application Grid Node Grid Node Grid Node Grid Node Process © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  41. 41. In Place ProcessingApplication Application Application Application Grid Node Grid Node Grid Node Grid Node Process © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  42. 42. Querying CoherenceApplication Application Application Application Grid Node Grid Node Grid Node Grid Node Query © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  43. 43. Coherence Events SubsystemApplication Application Application Application Map Grid Node Grid Node Grid Node Listener Grid Node © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  44. 44. Putting it All Together Web Sockets Load Balancer JEE JEE JEE JEE JEE Cluster Cluster Cluster Cluster Cluster Process Node Node Node Node Node Applica Applica Applica Applica Applica Applica Applica Cac tion Cac tion Cac tion Cac tion Cac tion Cac tion Cac tion he he he he he he he Applica Applica Applica Applica Applica Applica Applica Cac tion Cac tion Cac tion Cac tion Cac tion Cac tion Cac tion he he he he he he he Applica Applica Applica Applica Applica Applica Applica Cac tion Cac tion Cac tion Cac tion Cac tion Cac tion Cac tion he he he he he he heData Grid © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  45. 45. BE RADICALBuild New Architectures With Coherence! © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved
  46. 46. © C2B2 Consulting Limited 2011 www.c2b2.co.uk All Rights Reserved

×