-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define flush-to-disk guarantees and control #50
Comments
Yeah. We found this to be a big performance issue. So we'd definitely like to have this. Most likely the right default would be to not flush since many times developers use IndexedDB as an async version of localStorage. |
I think we're in favor of this too, just a matter of ensuring out backing store is up for this. |
The spec has long explicitly required both the A and D of ACID, and probably implicitly requires the C and I. The spec should not get into requiring specific implementation details of that ACIDity. If an implementation can be ACID without flushing, good for them. If an implementation see's a noticeable performance hit while flushing, they should work on that. I think this would be complexity inappropriate for a web-facing API, and we will be against making it a requirement. |
For performance reasons, we (Chrome) are considering making the flush optional. Example: db.transaction(scope, "readwrite", {preventFlush: true}); |
I like To be clear, we (Chrome) would like to provide a mode that skips writing to the storage medium ( Also, I wouldn't be against Firefox's approach of disabling |
AsideTo clarify, Firefox's IndexedDB is built on top on SQLite and since 2015 has used its Write-Ahead-Log in On the issueI'd like to instead propose that we address this via storage buckets. When creating a bucket, the site would specify what level of durability it wants the bucket to have (among other things). This provides a ton of implementer latitude just beyond "do we do an fsync at the end", as well as providing a gateway to improved storage eviction and improved user control on what's being stored on their device. Also, in the event corruption of a database happens (which realistically is a thing that can happen, although thankfully we're past some of the darkest days of this), it makes it easier to limit the spillover damage. I think in theory, per spec, browsers would wipe the entire origin if any database in the origin became corrupt, but in practice I suspect they all just throw errors on the database until you delete it. Buckets would help with this too. |
TPAC 2019 Web Apps breakout: #CaliforniaRelaxed
IDL sketch: enum IDBTransactionDurability { "default", "strict", "relaxed" };
dictionary IDBTransactionOptions {
IDBTransactionDurability durability = "default";
};
// in IDBDatabase:
...
[NewObject] IDBTransaction transaction(
(DOMString or sequence<DOMString>) storeNames,
optional IDBTransactionMode mode = "readonly",
optional IDBTransactionOptions options = {});
... @asutherland - how does that look? Happy to bikeshed the naming. Also: Should we add a readonly |
Looks good. We already have consensus on this, but we want to make sure the spec definition of durability should come from the buckets spec once that exists. (Not just inheriting of the behavior.) At triage just now, we've also agreed that exposing the durability property makes sense. |
Awesome. Any volunteers to write a spec PR here? (IMHO we can start sketching out a definition of durability here and then migrate it to Storage when Buckets land.) |
Add IDBTransactionOptions/durability option and IDBTransaction/durability Resolved #50
Add IDBTransactionOptions/durability option and IDBTransaction/durability Resolved #50
I see that relaxed durability has landed in Chrome 83: https://www.chromestatus.com/feature/5730701489995776 Is there a benchmark that demonstrates the performance difference between relaxed and strict durability? Looking at the Chromium commit, it references a benchmark in a Chromium bug that appears to be Google-internal. I tried it myself, and so far I am not able to see a performance difference, but I'm not sure exactly what kind of workload would suss out the difference. However anecdotally, I do see the same kind of performance differences between Chromium and other engines described in this post. |
@nolanlawson Sorry, I just noticed your comment here. I opened up the bug referenced by the commit. I opened up the bug mentioned above. The benchmark in this comment may also help. |
Define flushing guarantees and expose control
e.g. make transactions not flush-to-disk by default, but introduce a "readwriteflush" mode or {flush: true} option
Currently, FF does not flush (but wants an option), Chrome always flushes.
The text was updated successfully, but these errors were encountered: