Performance testing#12541
Open
tumbledwyer wants to merge 6 commits intodevelopfrom
Open
Conversation
c29c74d to
d9d584a
Compare
|
Oops! Looks like you forgot to update the changelog. When updating CHANGELOG.md, please consider the following:
|
|
ℹ️ Coverage metrics explained: |
📊 commons test coverage |
Contributor
|
Your environment is deployed to https://performance-testing.e2e-k8s.opencrvs.dev |
Zangetsu101
approved these changes
May 7, 2026
Contributor
Zangetsu101
left a comment
There was a problem hiding this comment.
Awesome work. Just wondering would it be easier to maintain a events cache tied to the request's lifecycle instead of passing it around?
| export async function getLeafLevelAdministrativeAreaIds() { | ||
| const db = getClient() | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| let leafLevelAdministrativeAreaIdsCache: Promise<any[]> | null = null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A number of improvements to increase the performance of OpenCRVS events service:
Remove the
wait_forwhen using the APIEvery request waits for elasticsearch to index the changes before returning.
This is on an interval of once per second.
This is useful from the UI so that refresh only happens once elasticsearch is updated.
From a performance testing perspective, it makes it impossible to get real number.
Changed to
wait_foron request from the client, API requests immediately return.Improved Zod schema parsing
Code previously parsed all Zod schemas and then checked how many it parsed and then selected highest priority if the number of parse matches was greater than 1.
Changed to order schemas by priority and then parse until it found a match. Logic is equivalent but dramatically reduces amount of processing on every request.
Cache Admin Structure
Admin structure is requested on every write operation, multiple times.
Added a cache since this almost never changes. This was the biggest saving in the tests.
Remove repeat calls to
getEventByIdMultiple calls to
getEventByIdin a single request. The event exists inctx.eventso does not need to be refetched.Used
ctx.eventwhere possible and passed event as a parameter otherwise. There is still some possible further optimisation here.Checklist