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.