IndexedDB size keeps growing even though data saved doesn't change IndexedDB size keeps growing even though data saved doesn't change google-chrome google-chrome

IndexedDB size keeps growing even though data saved doesn't change


Chrome uses LevelDB as a backing store for Indexed DB. You can read more about LevelDB at: https://github.com/google/leveldb

LevelDB is optimized for fast reads and writes. Space is lazily reclaimed through compaction.


I noticed the same behaviour in a Web-Application I am currently working on.
After doing some research, I found, that Chrome keeps old (deleted) Database-Files and only marks them as deleted. Also it will probably do some performance optimization which might increase space over time.
But once it reaches a specific size, it will automatically try to compress the database.I wanted to confirm this behaviour and added some code, which automatically reloads the webpage, once the data has been written into the Database.
In my case, the space needed by IndexedDB grew up to about 3.3MB. As soon as it reached this size, it has been compressed to about 1.3MB and started to grow again.