Best way to store data that needs to be accessed from multiple instances

233 Views Asked by At

What is the way to cache the sort of data that needs to be accessed basically constantly from different instances with the least overhead.

I'm currently using Mongo but it's creating too much overhead being accessed by each player very often. The issue is parties, where you can create a little gang of players and connect with them throughout our services. The services are sharded though (split within multiple instances), I cannot cache them locally as it'd need to be accessed again on another instance (if a party member is on an instance).

I was thinking of one of the following ways, but I don't know what type of database to pursuit it in.

onJoin: if not loaded pull from mongo db, store in some cache database that can be accessed like Mongo (Query.field("members." + uuid)) so I can keep it efficient and effective.

onLeave: if it's the last member then remove it from cache, and save data to mongo, ready for the next pull.

onUpdate: Periodically it'd save the data in the cache by doing some sort of loop to minimize any data loss, if anything unexpected was to happen.

I've looked into Jedis already, and as it's a basically a huge hashmap, it wouldn't be beneficial to loop through all the entries and check the values, especially because I want to use this as a scalable option.

0

There are 0 best solutions below