Lakshmikantha Reddy
Lakshmikantha Reddy

Reputation: 33

Can I use Ignite WebSessionFilter for web session caching in Ignite Client Node?

My requirement like below. Two webapps running in single Tomcat instance. We will deploy the application as cluster. WebApp1 - runs an Ignite server node, and forms cluster. Here session replication is achieved with WebSessionFilter as the Ignite cluster is running in this webapp. WebApp2 - This webapp requires session replication. I want to use WebSessionFilter with Clint node. This client node will access the cache from Ignite server node running in the same JVM.

Is this approach works?? I do not want to run another ignite cluster in WebApp2 just for session replication.

2024-04-05 17:43:14,253 UTC+0530 DEBUG [http-nio-8080-exec-2] org.apache.ignite.logger.jcl.JclLogger -- Using cached session for ID: B4BE9F96EB0BDA0FAA2E827AE2B1364F 2024-04-05 17:43:14,260 UTC+0530 ERROR [http-nio-8080-exec-2] org.apache.ignite.logger.jcl.JclLogger -- Failed to update web session: null java.lang.IllegalStateException: Cannot call sendError() after the response has been committed at org.apache.catalina.connector.ResponseFacade.checkCommitted(ResponseFacade.java:511) ~[catalina.jar:9.0.83] at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:344) ~[catalina.jar:9.0.83] at org.apache.chemistry.opencmis.server.impl.browser.CmisBrowserBindingServlet.service(CmisBrowserBindingServlet.java:266) ~[chemistry-opencmis-server-bindings-1.1.0.jar:1.1.0] at javax.servlet.http.HttpServlet.service(HttpServlet.java:623) ~[servlet-api.jar:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209) ~[catalina.jar:9.0.83] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) ~[catalina.jar:9.0.83] at org.apache.ignite.cache.websession.WebSessionFilter.doFilterV2(WebSessionFilter.java:564) ~[ignite-web-2.16.0.jar:2.16.0] at org.apache.ignite.cache.websession.WebSessionFilter.doFilterDispatch(WebSessionFilter.java:401) ~[ignite-web-2.16.0.jar:2.16.0] at org.apache.ignite.cache.websession.WebSessionFilter.doFilter(WebSessionFilter.java:377) ~[ignite-web-2.16.0.jar:2.16.0] at com.opentext.ecm.asm.cmis.http.filter.SessionFilter.doFilter(SessionFilter.java:113) ~[as_cmis.jar:?] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) ~[catalina.jar:9.0.83] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) ~[catalina.jar:9.0.83] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) ~[tomcat-websocket.jar:9.0.83] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) ~[catalina.jar:9.0.83] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) ~[catalina.jar:9.0.83]

I see some issues like below.

Upvotes: 0

Views: 43

Answers (1)

user21160483
user21160483

Reputation: 149

Apache Ignite is an in memory DISTRIBUTED cache. What you are describing is 1 Ignite instance (cache) in one JVM that leverages another JVM to get data from a single caching instance running on the JVM in the same host. There are 2 simpler ways to accomplish the above both of which would provide a simpler architecture and improved performance: 1.) Use 2 Ignite instances, 1 in each webapp. These 2 form 1 single 2 node cluster and use a replicated cache. This would allow both webapps to have full access to the entire cache data set along with its associated performance benefits. 2.) Use 2 Ignite instances, 1 in each webapp. These 2 form 1 single 2 node cluster and use a partitioned cache with 1 backup. This would also allow both webapps to have full access to the entire cache data set along with its associated performance benefits.

Best of all now you don't have to design an alternative caching approach in your second webapp. You have 2 webapps that use the exact same caching implementation. As such you have reduced code, reduced complexity and improved reliability!

Hope that helps!

Upvotes: 0

Related Questions