4 ms·
> 2GB of persistent storage 2 GB is a lot when you store plain json document data. > IndexedDb is the only option, it's slow on writes Only when you need a n
by postcoroner 4y ago
> 2GB of persistent storage
2 GB is a lot when you store plain json document data.
> IndexedDb is the only option, it's slow on writes
Only when you need a new transaction per write. Writing many documents in a single tx is not slow [1]
> Safari are known to delete IndexedDB after 1 week
This is not really a problem because if you have not used the app for one week, you can just replicate the data from the server again.
> WebAssembly based sqlite is coming along nicely too
WebAssembly cannot access the IndexedDB API. In my tests, all the wrappers that use webassembly are slower on writes the just using IndexedDB via javascript.
The fastest you can go is by using a Memory-Synced wrapper around IndexedDB, like LokiJS does it or the RxDB memory plugin. [2]
[1] https://rxdb.info/slow-indexeddb.html https://rxdb.info/slow-indexeddb.html
[2] https://rxdb.info/rx-storage-memory-synced.html https://rxdb.info/rx-storage-memory-synced.html
- mgkimsal 4y ago> This is not really a problem because if you have not used the app for one week, you can just replicate the data from the server again. You can't if you haven't been able to push up the data for a week. But in that case, you'd just have to remember to 'use it' ever day or so. Had a use case a few years back for data collection app in remote African villages. There were definitely situations where a week without decent data access were possible, and 'offline' became a requirement.
- postcoroner 4y agoCool, but we are talking about a PM tool here, so what really matters is people having no/slow internet for a short period of time.
- iudqnolq 4y ago"I lost data because I went on a vacation" is not an acceptable failure mode. Users understand "no data is saved" or "all data is saved," complex rules will lead to pain.
- nisten 4y agoI had not looked into RxDB before thank you. By any chance you know how much their Premium plugin with IndexedDB support costs, their price is not listed.
- postcoroner 4y agoYou could use the dexie.js based storage [1] as a start. It is fast enough for most use cases and comes for free. [1] https://rxdb.info/rx-storage-dexie.html https://rxdb.info/rx-storage-dexie.html
- nisten 4y agoIt looks like dexie supports svelte, this is pretty awesome thank you. https://dexie.org/docs/Tutorial/Svelte https://dexie.org/docs/Tutorial/Svelte