paulirotta / Tantalum

Tantalum Cross Platform Library
12 stars 6 forks source link

Study: explore reusing same RecordStore instance #8

Closed vivainio closed 11 years ago

vivainio commented 11 years ago

Currently (RMSUtils.java) we open separate RecordStore for every record we read.

Explore the performance (benchark!) of reusing same RecordStore for all items.

paulirotta commented 11 years ago

Could be valuable. Some phones complain or take a long time to uninstall when there are many many recordstores.

It would require a bit more housekeeping to track the key values which are done for you when each items is in an own record store.

vivainio commented 11 years ago

Assigning to @juhanak for study

paulirotta commented 11 years ago

Excellent to have this checked. It could help as we get a large number of RMSs and in some cases, that means it takes a long time to uninstall the app and other problems.

One request if we go this way- let's keep the details behind the FlashCache interface and preserve the ability to switch back until a new implementation is well tested. We should make sure the new implementation always settles to a stable state if the app crashes, runs out of battery without warning etc. Thus if we start keeping key-value data in one or more RMSs, there may be a need to check integrity and load data into RAM on startup and the speed of this operation could potentially have an impact on app start speed. We already load keys from flash synchronously on startup and should probably continue to do so as it keeps other parts of the architecture a lot simpler.

vivainio commented 11 years ago

@juhanak won't "publish" a new implementation before we see some pretty extensive benchmark data that it's worth it in the first place. If we agree that new implementation would be worth the while, we come back to the design. Most likely maintaining both approaches hidden behind FlashCache. After that come crash survival analysis etc.

But benchmarking is a start :).

paulirotta commented 11 years ago

Not opening and closing RMSs all the time should help performance. It would be great to get rid of the LRU "keep the last 10 RMSs that were accessed open" as it is a bug magnet but performance aid in some cases. Recovery from crash without hang states is the risk.

paulirotta commented 11 years ago

Started on this. Surprisingly complex to do it right

paulirotta commented 11 years ago

Done and merged into master. It is a good bit faster, and faster to uninstall an app that has far less RMSs