Hi Paul,The wildfly is able to locate the jar and use it it as a session store.
However I'm currently hardcoding the collection name. Is it possible to pass the collection name from xml, either through custom attribute within <store> or custom property under <store> ?
private String connectionURI = "mongodb+srv://localhost:27017";
private String collection = "jstore";
public MongoDBStoreConfigurationBuilder(PersistenceConfigurationBuilder builder) {
super(builder, MongoDBStoreConfiguration.attributeDefinitionSet());
}
Hi Paul, yes it is meant to be an external HttpSession store.- I would prefer it to be read store as well as it will be used as distributed cache. Are you seeing any problem that I missed?
So far I have only tested with passivation="false", I will need to try again with passivation="true".
- The configuration xml for property element that I provided is not working at the moment so this would be my main concern for now.As I would need to find a way not to hardcode it.- The collection name is currently hardcoded inside MongoDBStoreConfigurationBuilder. Following is the code snippet for the hardcoded value:
On Friday, April 14, 2023 at 5:34:10 AM UTC-4 Ronny Gunawan wrote:Hi Paul, yes it is meant to be an external HttpSession store.- I would prefer it to be read store as well as it will be used as distributed cache. Are you seeing any problem that I missed?
I think you may have some misconceptions about the role of the cache store within Infinispan [1].In general, Infinispan's distributed-cache stores all cache entries within the collective heap of the cluster.Infinispan will only attempt to read a given cache entry from the cache store if it is not found in memory (either locally or remotely).
A cache store operates in 2 modes:* Persistence, i.e. passivation="false"+ Cache entries are persisted to the store for every write operation, removed from the store for every remove operation, and read from the store if the entry was not found in memory (locally or remotely).+ Since a distributed (or replicated) cache stores all cache entries in memory (either locally or remotely), Infinispan will never read from a persistent cache.+ Using a cache with a persistent store, the cache store will always contain a redundant copy of any entry in memory* Passivation, i.e. passivation="true"+ Cache entries are persisted to the store for every eviction operation, and removed from the store for every get operation+ In a passivation-enabled cache, a given entry exists either in memory (locally or remotely) or in the store, but never both.Consequently, the only cache types with reasonable use cases for a persistent cache store are local-cache and invalidation-cache.In other words, you *could* configure WildFly's distributed HttpSession manager to use an invalidation-cache with a *shared* persistent store using the MongoDB cache store.However, the only tangible benefit to this type of configuration over the default HA configuration is the potential to scale the number of active sessions independently from (and beyond that of) your WildFly cluster.However, most users find the scaling characteristics of a passivation-enabled distributed cache to be sufficient such that it is more appealing than the lower performance of a shared persistence solution.Out of curiosity, what is the motivation for using MongoDB in this way?
Hi Paul, please find my comments below.- This is the behavior that we would like to have where it will read from cache store when it's not found in memory locally. Our objectives is to test distributed cache on Wildfly.
Currently we are on default behavior where session is stored in memory and once an instance go down then there is no where to continue the session in the other running instance.
Please correct me if distributed-cache will allow the user to continue their session in other instance within the same server group.
- We have got existing approved MongoDB so we could leverage it. Otherwise, it will need to go through another approval for a new relational database system
Thank you Paul for your suggestion and appreciate your advice.I will follow your suggestion to use the default behavior and observe it before implementing a shared persistent cache store using an invalidation cache.By the way, a side track question, what is the difference of running ha profile in domain mode vs standalone mode?ha profile in domain mode is quite obvious but how could a ha profile used in standalone mode? Does it mean if I have few instances of standalone wildfly then they can behave like it would be in a domain mode?