Design Doc: go/idb-explicit-commit
An API call will be added to the chrome IndexedDB transaction implementation that will allow developers to explicitly commit a transaction with which they are finished. At present IndexedDB only commits transactions through an autocommit functionality by which it detects whether or not a transaction is no longer reachable and, when the transaction is determined to be unreachable, marks it as 'committable' accordingly.
The primary benefit of the explicit commit functionality is that it will increase the throughput of read and write requests made on an object store. This is a clear performance benefit in terms of the rate at which operations can be processed, and the increase in speed is additionally advantageous because it adds stability to IndexedDB by reducing the probability that a disruptive event occurs within the lifetime of a transaction.
To provide a particular use case, the explicit commit() functionality is critical for allowing the Lifecycle API to use IndexedDB as the backing store of choice when saving tab state. Presently developers must use localStorage when saving tab state on shutdown because IndexedDB’s autocommit flow does not have guarantees as strong as those of localStorage when it comes to ensuring that data will still be written to disk even in the event that a tab is shut down before the data is actually finished writing. IndexedDB is a much more well-behaved database in most other respects, so allowing the Lifecycle API to rely on IndexedDB rather than localStorage will be a marked improvement. See: https://developers.google.com/web/updates/2018/07/page-lifecycle-api#save-data-to-indexeddb-before-freezing
Interoperability and Compatibility
Edge: Public Support: https://github.com/w3c/IndexedDB/pull/242#issuecomment-428385752
Firefox: Public Support: https://github.com/w3c/IndexedDB/pull/242#issuecomment-401936151
Safari: Public Support: https://github.com/w3c/IndexedDB/issues/234#issuecomment-391109023
As stated previously, the explicit commit() function will be useful for the Page Lifecycle API: (https://developers.google.com/web/updates/2018/07/page-lifecycle-api#save-data-to-indexeddb-before-freezing). Exposing an explicit commit() function will increase the performance of Page Lifecycle efforts and thus, by increasing stability, the performance of Chrome.
It will not be challenging for developers to incorporate IndexedDB transaction commit() right away.
Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
Link to entry on the feature dashboard
Requesting approval to ship?