Browser Database Selection

Dear Dev (and other opinionated people)

We have been working on a ticket to diagnose why the OpenLMIS-UI is crashing in the Malawi implementation, and while we are not 100% sure we have found all the reasons for the UI crashing, the primary issue we have been able to reproduce is that the way we are loading and caching large data from OpenLMIS Services is causing large performance issues. The root cause is that the browsers local storage is synchronous, which locks up the main thread, and then eats up memory causing a case condition. The solutions is to switch to using IndexDB which is built into Chrome and Firefox web browsers.

Please give me feedback about which library we should use to wrap IndexDB (because the native syntax and error reporting is buggy across browsers)

There are two choices:

(A) PouchDB

(B) Dexie.js

I’ll admit that I love PouchDB (and CouchDB). I think PouchDB is a good long term approach because its a lazy datastore, so we won’t need to worry about deleting all locally stored data on an upgrade or making a DB migration plan (we can just let Javascript do its untyped weird things)

On the other hand, Dexie.js is under half the size of PouchDB (16kb vs 45kb gzipped) and I think its a totally acceptable strategy to delete cached data when updating the UI

Thoughts?

– nick –

···

Nick Reid | nick.reid@villagereach.org

Software Developer, Information Systems Group

VillageReach** *** Starting at the Last Mile
*2900 Eastlake Ave. E, Suite 230, Seattle, WA 98102, USA

CELL: +1.510.410.0020

SKYPE: nickdotreid

www.villagereach.org

Imho the 30kb isn’t a big deal, since it’s just a one time download (the lib is cached right?). I’m pretty sure we still have API responses that are larger.

I would go with the lib you feel is a better fit - which as I understand is PouchDB.

Regards,

Paweł


SolDevelo
Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41

···

On Wed, Sep 13, 2017 at 8:04 PM, Nick Reid nick.reid@villagereach.org wrote:

Dear Dev (and other opinionated people)

We have been working on a ticket to diagnose why the OpenLMIS-UI is crashing in the Malawi implementation, and while we are not 100% sure we have found all the reasons for the UI crashing, the primary issue we have been able to reproduce is that the way we are loading and caching large data from OpenLMIS Services is causing large performance issues. The root cause is that the browsers local storage is synchronous, which locks up the main thread, and then eats up memory causing a case condition. The solutions is to switch to using IndexDB which is built into Chrome and Firefox web browsers.

Please give me feedback about which library we should use to wrap IndexDB (because the native syntax and error reporting is buggy across browsers)

There are two choices:

(A) PouchDB

(B) Dexie.js

I’ll admit that I love PouchDB (and CouchDB). I think PouchDB is a good long term approach because its a lazy datastore, so we won’t need to worry about deleting all locally stored data on an upgrade or making a DB migration plan (we can just let Javascript do its untyped weird things)

On the other hand, Dexie.js is under half the size of PouchDB (16kb vs 45kb gzipped) and I think its a totally acceptable strategy to delete cached data when updating the UI

Thoughts?

– nick –

Nick Reid | nick.reid@villagereach.org

Software Developer, Information Systems Group

VillageReach** *** Starting at the Last Mile
*2900 Eastlake Ave. E, Suite 230, Seattle, WA 98102, USA

CELL: +1.510.410.0020

SKYPE: nickdotreid

www.villagereach.org

You received this message because you are subscribed to the Google Groups “OpenLMIS Dev” group.

To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev+unsubscribe@googlegroups.com.

To post to this group, send email to openlmis-dev@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/CY4PR02MB3350DA25F197F590997673FA946E0%40CY4PR02MB3350.namprd02.prod.outlook.com.

For more options, visit https://groups.google.com/d/optout.

Paweł Gesek

    Technical Project Manager

     pgesek@soldevelo.com / +48 690 020 875

As I’m new to the whole browser DB concept I would pick up the db you have the most experience with.

···

On Wednesday, September 13, 2017 at 8:04:58 PM UTC+2, Nick Reid wrote:

Dear Dev (and other opinionated people)

We have been working on a ticket to diagnose why the OpenLMIS-UI is crashing in the Malawi implementation, and while we are not 100% sure we have found all the reasons for the UI crashing, the primary issue we have been able to reproduce is that the way we are loading and caching large data from OpenLMIS Services is causing large performance issues. The root cause is that the browsers local storage is synchronous, which locks up the main thread, and then eats up memory causing a case condition. The solutions is to switch to using IndexDB which is built into Chrome and Firefox web browsers.

Please give me feedback about which library we should use to wrap IndexDB (because the native syntax and error reporting is buggy across browsers)

There are two choices:

(A) PouchDB

(B) Dexie.js

I’ll admit that I love PouchDB (and CouchDB). I think PouchDB is a good long term approach because its a lazy datastore, so we won’t need to worry about deleting all locally stored data on an upgrade or making a DB migration plan (we can just let Javascript do its untyped weird things)

On the other hand, Dexie.js is under half the size of PouchDB (16kb vs 45kb gzipped) and I think its a totally acceptable strategy to delete cached data when updating the UI

Thoughts?

– nick –

Nick Reid | nick...@villagereach.org

Software Developer, Information Systems Group

VillageReach** *** Starting at the Last Mile
*2900 Eastlake Ave. E, Suite 230, Seattle, WA 98102, USA

CELL: +1.510.410.0020

SKYPE: nickdotreid

www.villagereach.org