0

I have to build a sort-of in-memory database, I know I can use in-memory-data-management solutions like EhCache and HazelCast, but I am inclined towards not plugging them into my system and achieving using Weblogic session replication.

Below are my question:

  • Since this is actually not a user session, can I create a session on application startup and then use Weblogic session replication feature to achieve session replication?
    • Or should I consider Weblogic application context replication and is it possible?
  • Do I mandatorily need to have Weblogic cluster to make use of WL session replication or it can be done without it as well?
  • Suppose I have 4 WL servers (running on different boxes) and all in same cluster, if any node/server has got the data and put it into the session then will it replicate automatically in all other nodes/server?
  • Suppose I shutdown 3 nodes/server, upon restart of those nodes, will my alive nodes automatically push data into starting nodes?
pjj
  • 2,015
  • 1
  • 17
  • 42

1 Answers1

3

You should not use Web Sessions as an in-memory database. Most of the in-memory databases allow for fine-tuning of how data is distributed across the nodes. They also have transaction and recovery support. Web Sessions are very simple replication of Java objects between nodes, and you shouldn't even hold critical data in there. The main purpose of replicating data in a Web Session object is, in case a server goes down, to keep user logged in in another server, and to continue its work, ie some stateful web UI.

Depending on what WebLogic edition you are using (based on which license it was acquired), you may already have access to Coherence, the Oracle In-memory Data Grid solution.

Update OP's questions properly answered below.

Since this is actually not a user session, can I create a session on application startup and then use Weblogic session replication feature to achieve session replication?

  • Or should I consider Weblogic application context replication and is it possible?

Objects in Application Scope (of the Web app) are not replicated. You may be able to use JNDI to do that though, but again I do not recommend neither of these approaches (including a startup listener to push things, somehow, to a session).

Do I mandatorily need to have Weblogic cluster to make use of WL session replication or it can be done without it as well?

Yes, a WebLogic Cluster is needed, if you want Session replication. There are some requirements beyond using a Cluster. See documentation chapter 6 Failover and Replication in a Cluster, in WLS 12.2.1 Docs.

Suppose I have 4 WL servers (running on different boxes) and all in same cluster, if any node/server has got the data and put it into the session then will it replicate automatically in all other nodes/server?

Not to all servers, only to a few. See documentation for more details on using Replication Groups and other options.

Suppose I shutdown 3 nodes/server, upon restart of those nodes, will my alive nodes automatically push data into starting nodes?

It is not so simple, but in short, it does not work as you wished. Sessions are not replicated to all nodes within a WebLogic Cluster. Replication occurs to enough nodes (a primary node, and a secondary node). More information on WLS Docs for 12.2.1.

Again, you should not use HTTP Session Replication feature as an in-memory database. It was not designed for that at all. Instead of "building a sort-of in-memory database", use one.

But if you really, really want to use HTTP Session as an "In-memory database", at least make sure you use Coherence*Web as the replication mechanism in WebLogic.

Bruno Borges
  • 853
  • 7
  • 24
  • I think the web sessions will supports transaction management and recovery, right? My data is not critical but I think only problem I will have will be to create clusters to support web sessions, right? Also, I am wondering how does it matter if I keep critical data in web sessions, in-memory data management solutions like EhCache also do same thing, keeping things in server memory, right? I would be much obliged if you could provide your inputs targeting each question, – pjj Feb 04 '16 at 13:08
  • My point is, if you have access to a supported and licensed in-memory data grid solution, why rely on something that was **not designed** to do what you want to do? – Bruno Borges Feb 04 '16 at 23:24
  • That's fine, I know that and I have mentioned in my question as well .. That doesn't answer my question .. – pjj Feb 06 '16 at 15:27