Skip to content

IndexedDB durability #34

rhashimoto started this conversation in General
IndexedDB durability #34
Jan 20, 2022 · 0 comments

IndexedDB performance is noticeably worse on Chrome (and probably all Chromium-based browsers, including Edge), in part because transactions are slow. A major contributing factor is that Chrome flushes transactions all the way to disk to improve durability (i.e. the D in ACID), while other browsers do not. Test 1 on the wa-sqlite benchmarks page demonstrates this, with Chrome taking about 18 seconds on my local machine, while Firefox and Safari each take roughly 3 seconds.

Chrome provides a non-standard option for relaxed durability similar to the other browsers. With this option enabled, Chrome takes about 7 seconds for the same test - still not quite as good as Firefox/Safari but much better than before. Google has proposed this option as an addition to the IndexedDB spec, but that doesn't seem to be making any progress.

I considered adding Chrome's relaxed durability to IndexedDbVFS, but I eventually decided not to go outside the standard and to write this post instead. It's an easy change, just add { durability: "relaxed" } as a third argument to IDBDatabase.transaction(). Most importantly here, but there are a few other less impactful places.

Replies

0 comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant