Coherence sig-nfr-web-tier-scaling-using-coherence-web

  • 185 views
Uploaded on

Coherence sig-nfr-web-tier-scaling-using-coherence-web

Coherence sig-nfr-web-tier-scaling-using-coherence-web

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
185
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
9
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • There are actually some more caches involved here:session-managementThis cache is used to store internal configuration and management information for the session management implementation. This information is updated infrequently; therefore, it is a replicated cache by default.servletcontext-storageIf ServletContext attribute clustering is enabled (it is disabled by default), this cache is used to store ServletContext attributes. This cache is replicated by default, as it is expected that there will a few read-mostly attributes.session-storageThis cache is used to store session models. By default it is mapped to a near cache backed by a distributed cache since it is expected that a container will access and modify a subset of sessions multiple times (assuming that sticky session load balancing is configured.)session-overflowIf the coherence-sessioncollection-class parameter is set to com.tangosol.coherence.servlet.SplitHttpSessionCollection, this cache will hold "large" session attributes. By default, session attributes larger than 1K will be stored in this cache. This is configured as a distributed cache.session-death-certificatesRecently expired session IDs are stored in this cache in order to prevent reuse of a recently used session ID. By default, each storage node will hold up to 4000 session IDs, and session IDs will be evicted after 24 hours. This is configured as a distributed cache.
  • Improves memory performance and near cache usageOld binary value must be cached for the test to take place

Transcript

  • 1. Non-functional benefits of Scaling your Web Tier using Coherence*Web
  • 2. Mark Addy, Consultant Fast, Reliable, Manageable & Secure
  • 3. HTTP Session Management
  • 4. Life Before Coherence
  • 5. Non-Clustered SessionCache Server Application Load-Balancer SessionCache Server Application SessionCache Server Application
  • 6. Non-Clustered • Sticky Session Load-Balancer • No Redundancy • Session Cache bloats Application JVM Heap
  • 7. Clustered - Replicated SessionCache Server Application Load-Balancer SessionCache Server Application SessionCache Server Application
  • 8. Clustered – Replicated • Sticky Session Load-Balancer • Redundancy / Failover • Too much Redundancy? • Session Cache bloats Application JVM Heap • Replication overhead increases proportionally to the number of nodes • Adding more node != more Session Storage capacity • Tuning and Scaling of the Session Cache is coupled to the Application
  • 9. Clustered – Backup / Buddy Replicas SessionCache Server Application Load-Balancer SessionCache Server Application SessionCache Server Application
  • 10. Clustered – “Buddy Replicas” • Sticky Session Load-Balancer • Implementations – WebLogic Clustering – JBossCache Buddy Replication – Tomcat Backup Manager • Redundancy / Failover • Redundancy is more realistic • Adding more nodes == Increased session storage • Session Cache bloats Application JVM Heap • Tuning and Scaling of the Session Cache is coupled to the Application
  • 11. The Challenges • Redundancy – Transparent Failover – Rolling upgrades / zero downtime • Coupling – Independent Tuning – Independent Scaling • Latency – High access HttpSession Metadata / Attributes
  • 12. Coherence*Web
  • 13. Coherence*Web • Http Session Management Module • Built directly on top of Coherence – Scalability – Availability – Reliability – Performance
  • 14. Coherence*Web Integration
  • 15. Active Cache Integration into WebLogic Server & GlassFish • WebLogic 10.3.3+ – Requires installation of active-cache and coherence-web- spi shared libraries
  • 16. Active Cache • Management via console or WLST • Process control via Node Manager – Including auto-restart for failed nodes • Application Configuration via WebLogic Deployment Descriptors
  • 17. Other Containers
  • 18. Supported • Apache Tomcat 5.5.n, 6.0.n • IBM WebSphere 5, 6, 7 • JBoss Application Server • Jetty 5.1.n, 6.1n • Oracle OC4J 10.1.2.n, 10.1.3.n • Oracle WebLogic 9, 10 • Sun Application Server • Sun GlassFish 2.n
  • 19. Stage 1 - Inspection java -jar webInstaller.jar ${war} -inspect -server:Tomcat/6.0.x • Generates Coherence*Web parameters for target container (coherence-web.xml) • Amend settings in this file prior to the installation stage
  • 20. Stage 2 - Installation / Instrumentation java -jar webInstaller.jar ${war} -install • Applies Coherence*Web context parameters to Application web.xml using the coherence-web.xml file generated in the inspection step • Unregisters Application ServletContext, ServletRequest and HttpSession Listeners • Registers Coherence*Web ServletContext Listeners • Wraps Servlets with Coherence*Web SessionServlet • Wraps JSP’s with Coherence*Web JspServlet
  • 21. Redundancy, Availability & Scalability
  • 22. Partitioned / Distributed Clustering SessionCache Server Application Load-Balancer SessionCache Server Application SessionCache Server Application
  • 23. Partitioned / Distributed Clustering • Configurable Number of back-ups • Coherence Grid hides data-location • Dynamic Scaling • Replication overhead does not increase with cluster size • Sticky Sessions might not be routed to the Node owning the data
  • 24. The Coupling Challenge
  • 25. Coherence*Web Topology Traditional Http Session Caches are embedded We have a choice to make: • In-process – Embedded • Out of process – Storage disabled • Out of process – Coherence*Extend
  • 26. In-Process
  • 27. In-Process Coherence Node Server Application Coherence Node Server Application Coherence Node Server Application Coherence Node Server Application
  • 28. In Process • Fast In memory access when replicated • Low session numbers • Good for Development • Application shares same JVM as Cache – Unable to Scale independently – Unable to Tune Application and Cache independently – Restarts of Application Nodes impact the cluster – Increased Heap size and GC pauses
  • 29. Out of Process Storage Disabled
  • 30. Out of Process Storage Disabled Coherence Node Server Application Coherence Node Cache Server Coherence Node Server Application Coherence Node Server Application Coherence Node Server Application Coherence Node Cache Server Coherence Node Cache Server
  • 31. Out of Process Storage Disabled • Straight forward to configure -Dtangosol.distributed.local.storage=false • Application and Cache are separated – Independent tuning – Independent scaling – Looser Coupling • Application and Cache Tiers are Clustered
  • 32. Out of Process Coherence*Extend
  • 33. Out of Process Coherence*Extend Server Application Coherence Node Cache Server Coherence Node Cache Server Coherence Node Cache Server Coherence Proxy Cache Server Coherence Proxy Cache Server Server Application Server Application Server Application
  • 34. Out of Process Coherence*Extend • Application and Cache are totally separated – Independent tuning • Throughput Collector for Application? • Low Pause Collector for Cache? – Independent scaling – De-coupled – Reduced memory requirement for Application JVM – Sharing Session Cache is possible – Increased Latency
  • 35. The Latency Challenge
  • 36. Coherence*Extend Latency Server Application Cache Server Cache Server Cache Server Coherence Proxy Cache Server Coherence Proxy Cache Server Server Application Server Application Server Application SessionCache SessionCache SessionCache
  • 37. Reducing Latency We have control over the Coherence Cache Configuration <near-scheme> <scheme-name>near-cache-scheme</scheme-name> <front-scheme> <local-scheme> <scheme-ref>limited-local-near-cache</scheme-ref> </local-scheme> </front-scheme> <back-scheme> <remote-cache-scheme> <scheme-ref>unlimited-partitioned-remote-cache</scheme-ref> </remote-cache-scheme> </back-scheme> </near-scheme>
  • 38. Coherence*Extend Latency Server Application Cache Server Cache Server Cache Server Coherence Proxy Cache Server Coherence Proxy Cache Server SessionCache SessionCache SessionCache Server Application Server Application Server Application
  • 39. Near Cache • Front scheme is a subset of the Back scheme • Local caching for high access cache entries • Reduced Latency • Brings session state close for Sticky Sessions • Size limited to ensure Application heap is kept under control
  • 40. Latency & The Session Model
  • 41. Session Models Coherence*Web Session Models • Traditional • Monolithic • Split The Http Session • MetaData • Last Accessed Time • Created Time • ID • Attributes • Store what you want! • Not all Attributes are equal...
  • 42. Traditional
  • 43. Traditional HTTP Session Attribute 1 Coherence Node Attribute 2 Attribute 3 Attribute 4 ...1010011011... ...1010011011... ...1010011011... ...1010011011... 3 CacheKey HTTP Session ID 1 2 4 Cache Value
  • 44. Traditional HTTP Session Attribute 1 Attribute 2 Attribute 3 Attribute 4 ...10101... ...10101... ...10101... ...10111... Person HTTP Session Attribute 1 Attribute 2 Attribute 3 Attribute 4 Person Person
  • 45. Traditional • Good for small Sessions • Each Attribute is Serialized Independently • All Attributes are transferred together • Doesn’t work when attribute values point at the same Object
  • 46. mon·o·lith·ic
  • 47. Monolithic HTTP Session Attribute 1 Coherence Node Attribute 2 Attribute 3 Attribute 4 ...10101011010110011 1010100010100011... CacheKey HTTP Session ID Attributes 1, 2, 3 & 4 Cache Value
  • 48. Monolithic HTTP Session Attribute 1 Attribute 2 Attribute 3 Attribute 4 Person HTTP Session Attribute 1 Attribute 2 Attribute 3 Attribute 4 Person ...101111 010011...
  • 49. Monolithic • Good when your Session attributes require shared Object references to be preserved • Attributes are Serialized together • All Attributes are transferred together • Expensive – entire Session must be Serialized into a single Object Stream
  • 50. Split
  • 51. Split HTTP Session Attribute 1 Coherence Node Attribute 2 Attribute 3 Attribute 4 ...1010011011... ...1010011011... ...1010011011... ...1010011011... CacheKey Session ID 1 2 Cache Value 4 CacheKey Session ID:4 Cache Value 3 CacheKey Session ID:3 Cache Value
  • 52. Split • Default Coherence*Web Session Model • Attributes are Serialized independently • Large Attributes are transferred independently • Reduces network traffic • Separated handling of small and large attributes • Configurable “Large” Attribute Threshold
  • 53. Split in Action Cache Server session-storage session-overflow Server Application session-storage Server Application session-storage Server Application session-storage Cache Proxy Cache Proxy Cache Server session-storage session-overflow Near Local cache “small” session attributes and Meta Data Partitioned Remote cache “small” session attributes and Meta Data Partitioned Remote cache “large” session attributes
  • 54. Split • Large Session Attributes are off-loaded to a remote cache scheme • Frequently accessed attributes and MetaData held in near cache for performance
  • 55. Tracking Attribute Changes • Initial binary value vs New Binary Value – Object is mutable? – Initial == new (no change) – Initial != new (write to cache) • Check can be overridden if you never mutate attributes without calling HttpSession.setAttribute – Removing the check improves performance <context-param> <param-name>coherence-enable-suspect-attributes</param-name> <param-value>false</param-value> </context-param>
  • 56. Cluster Isolation
  • 57. Cluster Isolation Scope • Container • Enterprise Archive • Web Archive Determined by Class-loading Scope
  • 58. Container Scoping Application Server Enterprise Archive Web Archive Web Archive Web Archive Web Archive Coherence Node Application Server Enterprise Archive Web Archive Web Archive Web Archive Web Archive Coherence Node
  • 59. Container Scoping • Least Overhead – Libraries deployed on Container Class Path – Number of loaded Classes – Lowest Memory Requirement – One Coherence Cluster Node per Container • Least Separation – Multiple Applications share the same Cluster – Can be problematic...
  • 60. Enterprise Archive Scoping Application Server Enterprise Archive Web Archive Web Archive Coherence Node Enterprise Archive Web Archive Web Archive Coherence Node Application Server Enterprise Archive Web Archive Web Archive Coherence Node Enterprise Archive Web Archive Web Archive Coherence Node
  • 61. Enterprise Archive Scoping • Overhead – Libraries scoped to EAR – One Coherence Cluster Node per Application • Separation – Applications within the EAR share the same Cluster <weblogic-application> ... <library-ref> <library-name>coherence</library-name> </library-ref> ... <library-ref> <library-name>active-cache</library-name> </library-ref> ... </weblogic-application>
  • 62. Web Archive Scoping Application Server Web Archive Coherence Node Web Archive Coherence Node Web Archive Coherence Node Application Server Web Archive Coherence Node Web Archive Coherence Node Web Archive Coherence Node
  • 63. Web Archive Scoping • Overhead – Libraries scoped to WAR – One Coherence Cluster Node per Web Archive • Separation – Each Web Archive participates in its own cluster – Total Independence from negative external factors Reference via MANIFEST.MF Manifest-Version: 1.0 Extension-List: coherence active-cache coherence-Extension-Name: coherence active-cache-Extension-Name: active-cache ...or package in WEB-INF/lib
  • 64. So what can we do?
  • 65. Application Tier Shutdown
  • 66. Application Tier Shutdown Coherence Near Cache Server Application Coherence Node Cache Server Coherence Node Cache Server Coherence Node Cache Server Coherence Near Cache Server Application Coherence Near Cache Server Application Coherence Near Cache Server Application Cache Proxy Cache Proxy
  • 67. Application Tier Shutdown • Application and Cache are totally separated – Session State is retained by the Cache Tier
  • 68. Sharing Sessions
  • 69. Sharing Session State Across Applications & Containers WLS Server Application A WLS Server Application B Apache Tomcat Application C Cache Proxy Cache Proxy ... Cache Server Cache Server Cache Server SessionCache SessionCache SessionCache
  • 70. Session & Attribute Scoping
  • 71. Session Scoping • For Applications running under separate domains without a load-balancer: – http://consulting.c2b2.com – http://marketing.c2b2.com <context-param> <param-name>coherence-session-cookie-domain</param-name> <param-value>.c2b2.com</param-value> </context-param> • For Applications with different context paths: – http://www.acme.com/shared/portal – http://www.acme.com/shared/trading <context-param> <param-name>coherence-session-cookie-path</param-name> <param-value>/shared</param-value> </context-param>
  • 72. Session Attribute Scoping <context-param> <param-name>coherence-scopecontroller-class</param-name> <param-value>...</param-value> </context-param> • Global Scoping – AbstractHttpSessionCollection$GlobalScopeController • Application Scoping – AbstractHttpSessionCollection$ApplicationScopeController – Allows different applications sharing HttpSessions to use identically named attributes in isolation – Default implementation applies a configurable prefix – Pluggable control over whether attributes are shared or isolated <context-param> <param-name>coherence-application-name</param-name> <param-value>session-attribute-prefix</param-value> </context-param>
  • 73. Demo
  • 74. Summary • Independent Scaling • Independent Tuning • Near Cache Optimization offsets remote Latency • Split Session Model Attribute separation • Redundancy • Scalability • Availability • Performance
  • 75. Thanks for Listening Any Questions? http://www.c2b2.co.uk http://blog.c2b2.co.uk @c2b2consulting