Remove OPA filter dependency.base
calculation in optional body parsing
#3210
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.
Due to a detected performance concern for CPU as seen below,
Memory profile
alloc_objects profile
Load test results
Using a request body as below with a simple policy to check email domain.
Before this improvement
23 instances for 1000 rps
max GC pause : 500 µs (high number of small objects generated by the dependency.base functions seems to have contributed here)
max heap objects : 3.17M
max heap usage: 557 MB
After this improvement
11 instances for 1000 rps (50% reduced of CPU power)
max GC pause: 269 µs.
max heap objects : 1.28M (50% reduced.)
max heap usage: 236 MB
Bench-mark test results
Before
BenchmarkAuthorizeRequest/authorize-request-with-body-8 10002 1068249 ns/op 8432573 B/op 806 allocs/op
After
BenchmarkAuthorizeRequest/authorize-request-with-body-8 13461 587883 ns/op 8418624 B/op 566 allocs/op