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

[CEP] Cache formplayer's validate_form's result on HQ to improve App Preview Refreshes #30147

Open
sravfeyn opened this issue Jul 28, 2021 · 5 comments
Labels
CEP CommCare Enhancement Proposal

Comments

@sravfeyn
Copy link
Member

sravfeyn commented Jul 28, 2021

Abstract
Formplayer's validate_form is triggered during app-preview. This CEP proposes to cache the validation result on HQ side to save time when validating forms repeatedly while doing app-preview.

Motivation
On HQ, forms are validated during app build using Formplayer's validate_form endpoint. During app-preview the user might make small incremental changes, refresh the app preview triggering the app builds. The forms are validated using Formplayer's endpoint again for each request. Given this is an HTTP request for each form in an app and for each app-preview refresh, if we can cache the result of the form we can have faster app-preview refreshes.

Specification

validate_form takes form_xml as the argument. We can add two additional args one hash of the form_xml and the other form-id. These two arguments can be used to store in quickcache for a duration of a day. The cache can be cleared whenever the form is modified.

Impact on users
App builders using app-preview will see faster subsequent load times.

Impact on hosting
The number of redis keys will increase by the sum of the number of forms in each app that is being built/downloaded. The number of requests to Formplayer validate_form endpoint will reduce by a good margin.

Backwards compatibility
This doesn't cause any incompatibility.

Release Timeline
A PR to be followed up if the proposal is okay.

Open questions and issues

@sravfeyn sravfeyn added the CEP CommCare Enhancement Proposal label Jul 28, 2021
@sravfeyn sravfeyn changed the title [CEP] Cache formplayer's validate_form's result on HQ [CEP] Cache formplayer's validate_form's result on HQ to improve App Preview Refreshes Jul 28, 2021
@orangejenny
Copy link
Contributor

This sounds great.

@sravfeyn
Copy link
Member Author

Also pinging @snopoke @proteusvacuum

@snopoke
Copy link
Contributor

snopoke commented Jul 30, 2021

LGTM. There is already some caching but I think it only cached validation errors.

@proteusvacuum
Copy link
Contributor

Sounds great to me!

@sravfeyn
Copy link
Member Author

sravfeyn commented Aug 6, 2021

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

No branches or pull requests

4 participants