node.js - When to save user data to disk? -
i've been getting web applications , node.js lately, , it's obvious should write user data disk, when should i? bit overkill , resource intensive write disk every time data updated, when should you?
simple, safe method: memory cache , disk saving
i'd recommend creating temporary memory (ram) cache store user data. (for data of active users)
this temporary disk cache should read , written though normal on-disk user save data. ensure every once in while cached data written disk, , you're go.
warnings / tips
- do not cache of data. (if expect have larger data ram on machine.) instead, cache user data of logged in / active users speed , efficiency.
- ensure autosave delay short enough avoid risk in case of crash. crashes happen. prepared.
Comments
Post a Comment