medic / cht-core

The CHT Core Framework makes it faster to build responsive, offline-first digital health apps that equip health workers to provide better care in their communities. It is a central resource of the Community Health Toolkit.
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
469 stars 217 forks source link

Switch to QuickJS for CouchDB JS engine #9575

Open garethbowen opened 1 month ago

garethbowen commented 1 month ago

Describe the performance issue

View rebuilding is slow which is a big problem particularly when doing an update which changes a view requiring the whole index to be rebuilt.

Describe the improvement you'd like

CouchDB 3.4.x introduced a new JS engine called QuickJS which promises 4-5x speed improvement and 6x improvement in memory usage. It's off by default. Try turning it on and see if we can get similar gains.

Describe alternatives you've considered

To Reproduce

  1. Get a db with a lot of realistic data
  2. Back up the db so you can re-run the test easily
  3. Change a view (even a whitespace change) to trigger a complete rebuild
  4. Measure the time, cpu usage, memory usage, disk usage until completion
  5. Restore the backup
  6. Change the JS engine to QuickJS (docs)
  7. Change the view and measure the time again

Measurements

Environment

Additional context

Blocked by #9303

lorerod commented 3 weeks ago

Moved to 4.15.0 so as not to hold up the release.

latin-panda commented 4 days ago

Moving it to 4.16