Network service data storage
I have a network service which shared data among connected clients. Connected clients are able to modify this data. This data is initially loaded from XML files, and saved back when the service shutdown.
I'd like to save this data periodically (or at each modification) because the service shall be in execution 24/24 7/7, indeed I need to find a convenient way to store the data from service. Saving data at each modification could not be feasible, since user requests could be frequent (10/50 requests per second), and some data could occupy up to 4/8 MB once serialized.
Now I'm saving the data periodically, after it is not modified after some time, but I don't like this approach. Is there some alternative to save data?
There is the possibility to have each client operation description, which say which field/property of which class has been modified; using this information it is possible to modify the data structure at later time, like a "macro" system does.
Maybe you can try scaling the diff?
You can test your data every second, and if difference between now and previous second is greater then 1 MB, you can save it. If not, you skip for this second.
Period and diff size can be changed due to your requirements.