vendredi 24 novembre 2017

Is there a common pattern to replace In Memory Datastores in a running application?

Let's say you have an application and this application is not using a common database, but a loads all the data in-memory and it works all from there.

Now, this is a WS and every few hours you want to 'update' your in-memory database. Since you don't want to risk an downtime and just want to replace the in-memory datastore on the fly. But there could be certain risk coming with that:

  • Certain data, which were available in the 'old' datastore might not be there anymore and if someone is consuming your data right in that moment, they will end up with an error.
  • Certain data could change and might just not be named the same or just slightly different.

I was just wondering if there is a certain approach or pattern for this kind of problem?

My approach would be to have for a certain time two datastores. The 'old' and the 'new' one. All new session get served by the new datastore and all old session will use the old datastore and might be forced to refresh to use the new one at some point. After that, I would throw the old one away and start the same song again.

Aucun commentaire:

Enregistrer un commentaire