Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache VDU functions so they are not called for each document #4612

Open
natcohen opened this issue May 22, 2023 · 1 comment
Open

Cache VDU functions so they are not called for each document #4612

natcohen opened this issue May 22, 2023 · 1 comment

Comments

@natcohen
Copy link

Summary

When adding 100 documents, CouchDB sends the VDU functions for each and every document (meaning that the VDU functions are sent 100 times). This leads to poor performances.

Desired Behaviour

A better implementation would be to cache the VDU functions so they are not sent as often to the JS engine

Possible Solution

Caching the functions or at least calling them only once per DB call.

Additional context

@rnewson
Copy link
Member

rnewson commented May 22, 2023

note that the function strings are cached (by load_validation_funs in couch_doc), but we send them to couchjs on every doc update, so we don't get any benefit from JIT and we're bloating the message we send to validate_doc_update over stdio.

see if we can do better here.

related PR #1898 which proposes another way to do VDU's without javascript at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants