gigaspaces global http session sharing october 2013 massive web application scaling
TRANSCRIPT
GigaSpaces Global HTTP Session Sharing
October 2013
Massive Web Application Scaling
® Copyright 2013 GigaSpaces. All Rights Reserved2
Web Application performance and HTTP Session Scalability Storing user sessions on disk or database slows down the application. Current HA implementation are too naïve and don't scale well.
Sharing user sessions between web applications transparently Essential for preserving the session state in case of a failure
Propagating user session across multiple data centers is not possible Although most modern web sites using this topology. Requires session replication over the WAN
High Web Server Memory Footprint Storing the HTTP session in-process increasing web server memory footprint Increasing the potential for garbage collection and long pauses.
WEB APP HTTP SESSION MANAGEMENT CHALLENGES
® Copyright 2013 GigaSpaces. All Rights Reserved3
Caches HTTP Session within the In-Memory Data-Grid Ensures superb performance and boost user experience No risk for application memory Unlimited scalability Ensures High-Availability and total consistency
Cross JEE Container session sharing Supports all major JEE servers on the market Allows migrating from one JEE server to another in a gradual manner
Multi-site & Multi-Cloud topologies Replicates sessions over the WAN across different cloud availability-zones
or across different cloud providers Both Active/Active and Active/Passive DR topologies support
MEET GIGASPACES GLOBAL HTTP SESSION SHARING
® Copyright 2013 GigaSpaces. All Rights Reserved4
Transparent Web application Failover Allow app server restart without any session data loss.
Any session data type attribute support Primitive and Non-Primitive (collections, user defined types) attributes supported. Serialized and Non-Serialized Session attributes support - Your attributes do not need
to implement Serializable or Externalizable interface. Sticky session and Non-sticky session support
Your requests can move across multiple instances of web application seamlessly. Atomic HTTP request session access support
Multiple requests for the session attributes within the same HTTP request will be served without performing any remote calls.
Master session copy will be updated when the HTTP request will be completed. Total session visibility
Session content can be viewed in real-time using rich client or web client. Simple setup
5 min configuration and you are done!
AND THERE’S MORE…
® Copyright 2013 GigaSpaces. All Rights Reserved5
HIGH LEVEL ARCHITECTURE
Tomcat farm
http session
http session
Websphere farm
http session
Jboss farm
Weblogic farm
http session
Data Grid
® Copyright 2013 GigaSpaces. All Rights Reserved6
HTTP SESSION MANAGEMENT – A CLOSER LOOK
Web application
Tempcache
GigaSpacesSession
Filter
Delta Update
http session
http request/response
Data Grid
Appservlet
Data Grid
Data Grid
LOAD-BALANCING SCENARIOS SUPPORTED
Non-Sticky session
Sticky session
X
Session Sharing Session Failover
HTTP SESSION SHARING ACROSS DIFFERENT JEE SERVERS/REGIONS
http session
http session
http session
Jboss farm
Tomcat farm
Websphere farm
Load balancer
Load balancer
Data Grid
Data Grid
Data Grid
Delta Update
Delta Update
Delta Update
Data Center BData Center A
Web application
TempCache
Appservlet
Delta Update
http session
http request/response
WAN Gateway
Web application
Appservlet
TempCache
GigaSpacesSession
Filter
http session
http request/response
HTTP SESSION SHARING ACROSS DIFFERENT REGIONS
Delta Update
Delta Update
Data Grid
Data Grid
GigaSpacesSession
Filter
US Site DE Site
US Gateway
Backup Partition 1
Primary Partition 1
Backup Partition 2
Primary Partition 2
DE
Delegator
Sink
RU
DE Gateway
US
Delegator
Sink
replicationProxy
RUBackup Partition 1
Primary Partition 1
Backup Partition 2
Primary Partition 2
RU Site
RU Gateway
DE
Delegator
Sink
replicationProxy
US
Backup Partition 1
Primary Partition 1
Backup Partition 2
Primary Partition 2
Websphere farm
Jboss farmTomcat farm
Backup Partition 3
Primary Partition 3
Backup Partition 4
Primary Partition 4
Backup Partition 3
Primary Partition 3
replicationProxy
HTTP SESSION SHARING ACROSS DIFFERENT REGIONS - HOW?
® Copyright 2013 GigaSpaces. All Rights Reserved11
Improve User Experience caching user preferences and session information on external JVMs
Ensure Business Continuity & Scalability by Session High Availability.
Scale to unlimited number of sessions and concurrent users using share nothing in memory architecture.
No code change – 5 minutes configuration and you’re good to go. Cross Containers Session sharing - share sessions between any
Java Web / App server. Allows smooth rolling upgrade. Atomic HTTP Request - Support concurrent session access Delta Updates – Replicate only session changes Non-Serializable Attributes Support – automatic serialization for
non-primitive Attributes
SUMMARY - GIGASPACES UNIVERSAL HTTP SESSION
® Copyright 2013 GigaSpaces. All Rights Reserved12
Configuring your web application to use GigaSpaces
HTTP session cache5 min task!
® Copyright 2013 GigaSpaces. All Rights Reserved13
THE WEB_INF/WEB.XML FILE
<web-app>....
<listener><listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-
class></listener><listener> <listener-class>org.openspaces.sessions.shiro.GigaCacheManager</listener-class></listener><filter>
<filter-name>ShiroFilter</filter-name><filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
</filter><filter-mapping>
<filter-name>ShiroFilter</filter-name><url-pattern>/*</url-pattern>
</filter-mapping></web-app>
Adding the following to your web.xml
® Copyright 2013 GigaSpaces. All Rights Reserved14
THE WEB_INF/SHIRO.INI FILE[main]sessionManager = org.apache.shiro.web.session.mgt.StandardWebSessionManager#set the sessionManager to use an enterprise cache for backing storage:sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAOsessionManager.sessionDAO = $sessionDAOsessionDAO.activeSessionsCacheName = jini://*/*/myDataGrid
# ensure the securityManager uses our native SessionManager:securityManager.sessionManager = $sessionManager
# whatever your CacheManager implementation is, for example:cacheManager = org.openspaces.sessions.shiro.GigaCacheManagercacheManager.sessionLease = 1800000cacheManager.cacheSessionLocally = true
# This will use GigaSpaces for _all_ of Shiro's caching needs (realms, etc), # not just for Session storage.securityManager.cacheManager = $cacheManager
securityManager.sessionManager.defaultSessionTimeout = 1800000
# Session validationsessionValidationScheduler = org.apache.shiro.session.mgt.ExecutorServiceSessionValidationScheduler
# Default is 3,600,000 millis = 1 hour:sessionValidationScheduler.interval = 1800000
sessionValidationScheduler.sessionManager = $sessionManager
securityManager.sessionManager.sessionValidationScheduler = $sessionValidationScheduler
Data Grid URL
Sticky or non-sticky session