perf(validator): optimize schema caching and fix k6 teardown#198
Merged
perf(validator): optimize schema caching and fix k6 teardown#198
Conversation
Signed-off-by: Jeremy Ho <jujaga@gmail.com>
This utility will allow us to use ajv's built in schema caching support Signed-off-by: Jeremy Ho <jujaga@gmail.com>
Signed-off-by: Jeremy Ho <jujaga@gmail.com>
Signed-off-by: Jeremy Ho <jujaga@gmail.com>
qhanson55
approved these changes
Mar 9, 2026
This change slightly improves memory performance by generating fewer AJV objects and using smarter logic to funnel repeated schema to the same pre-compiled definition. Signed-off-by: Jeremy Ho <jujaga@gmail.com>
d2f0c32 to
88170f5
Compare
|
qhanson55
approved these changes
Mar 9, 2026
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
This PR introduces a more robust and performant schema validation strategy by leveraging Ajv’s internal caching mechanisms and deterministic hashing. It also includes critical bug fixes for load testing scripts and general code quality improvements.
Key Changes
Schema & Validation Optimization
$id, enabling efficient lookups within the Ajv registry.validateSchemato use a centralized Ajv instance. This reduces memory overhead by preventing the redundant creation of validator objects and ensuring repeated schemas are funneled to pre-compiled definitions.Bug Fixes & Maintenance
putRecordsteardown logic where test records were not being fully removed from the environment.Technical Details
The new validation flow utilizes an
in-flightcompilation map to deduplicate simultaneous requests for the same schema, preventing race conditions and redundant CPU usage during async compilation.Related Issues/Tickets
Type of Change
Checklist
Instance Deployment
Note
To request for a cloud deployment for testing purposes, add the
deploylabel to this PR.Deployments will be removed when the PR is closed, merged, or the
deploylabel is removed.Additional Notes