Search code examples
databaseweb-applicationspersistencetemporary

Scale-able Persistence in Web Application


I am thinking to create a web app, my web host charges me according to how many times I do persistence in database if I do persistence after every CRUDoperation that will cost me too much, I am thinking of a solution that if I store data temporarily in ArrayLists or HashMaps and schedule my persistence i.e. persist after every 30mins or 1hour, will that work ? and if so then what would be maximum time, time after that should I need to persist my Collection so that I achieve less persistence in database.


Solution

  • I think this is basically a bad approach. Don't design your web app for your web host.

    persist after every 30mins or 1hour

    Such a design can cause you so many headaches in the future. Think about what will happen to the modifications when the app crashes (for whatever reason, imagine a power outage).

    On the other hand, from performance perspective, it can be useful to cache entities, see e.g.: http://memcached.org/