perf: introduce translator context#7535
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7535 +/- ##
==========================================
+ Coverage 72.34% 72.40% +0.05%
==========================================
Files 232 232
Lines 34209 34278 +69
==========================================
+ Hits 24749 24818 +69
- Misses 7681 7683 +2
+ Partials 1779 1777 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
wait #7534 |
|
/retest |
|
@kkk777-7 you might wanna merge the main branch to this branch to include the disk space cleaner. |
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
9527aa1 to
ce0cfcc
Compare
|
The gateway/internal/gatewayapi/resource/resource.go Lines 117 to 124 in 7cb5f72 |
This reverts commit 14a3784. Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
f9b5a6a to
3d4c714
Compare
Signed-off-by: kkk777-7 <[email protected]>
|
Think out load: could we also add other resources(Namespace,Secret,ConfigMap, etc.) to the translator context to avoid linear lookups to improve CPU performance? This could increase memory usage - shouldn't be much increase since we just mirror the slices that already in resource using pointers, but we should benchmark both CPU and memory to ensure we don’t introduce significant overhead. |
we should do that. |
+1 |
|
|
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
f8b98e9 to
6461f2c
Compare
|
/retest |
|
@arkodg |
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
|
/retest |
|
Friendly ping @zirain @zhaohuabing |
* perf: introduce translator context Signed-off-by: kkk777-7 <[email protected]> * perf: add policy map in translator context Signed-off-by: kkk777-7 <[email protected]> * chore: update tranlate bench Signed-off-by: kkk777-7 <[email protected]> * Revert "perf: add policy map in translator context" This reverts commit 14a3784. Signed-off-by: kkk777-7 <[email protected]> * add translator context method, remove unused function Signed-off-by: kkk777-7 <[email protected]> * update gatewayapi test output Signed-off-by: kkk777-7 <[email protected]> * add resources in translator context Signed-off-by: kkk777-7 <[email protected]> * add gatewayapi translate bench Signed-off-by: kkk777-7 <[email protected]> * fix: set resources in translator context Signed-off-by: kkk777-7 <[email protected]> * fix: go lint Signed-off-by: kkk777-7 <[email protected]> * address comments Signed-off-by: kkk777-7 <[email protected]> * feat: support egctl translate options Signed-off-by: kkk777-7 <[email protected]> * update: bench test Signed-off-by: kkk777-7 <[email protected]> * update embedded field Signed-off-by: kkk777-7 <[email protected]> * fix gatewayapi testdata output Signed-off-by: kkk777-7 <[email protected]> --------- Signed-off-by: kkk777-7 <[email protected]> Co-authored-by: zirain <[email protected]> Signed-off-by: Rudrakh Panigrahi <[email protected]>
* fix json report (#8614) Signed-off-by: Huabing (Robin) Zhao <[email protected]> Signed-off-by: Rudrakh Panigrahi <[email protected]> * fix: deep copy status in translator layer to avoid race (#8778) Signed-off-by: Rudrakh Panigrahi <[email protected]> * chore: setup translator test (#7627) * chore: setup gatewayapi translator test Signed-off-by: kkk777-7 <[email protected]> * remove: duplicate resources in testfiles Signed-off-by: kkk777-7 <[email protected]> * update gatewayapi test output Signed-off-by: kkk777-7 <[email protected]> --------- Signed-off-by: kkk777-7 <[email protected]> Signed-off-by: Rudrakh Panigrahi <[email protected]> * perf: introduce translator context (#7535) * perf: introduce translator context Signed-off-by: kkk777-7 <[email protected]> * perf: add policy map in translator context Signed-off-by: kkk777-7 <[email protected]> * chore: update tranlate bench Signed-off-by: kkk777-7 <[email protected]> * Revert "perf: add policy map in translator context" This reverts commit 14a3784. Signed-off-by: kkk777-7 <[email protected]> * add translator context method, remove unused function Signed-off-by: kkk777-7 <[email protected]> * update gatewayapi test output Signed-off-by: kkk777-7 <[email protected]> * add resources in translator context Signed-off-by: kkk777-7 <[email protected]> * add gatewayapi translate bench Signed-off-by: kkk777-7 <[email protected]> * fix: set resources in translator context Signed-off-by: kkk777-7 <[email protected]> * fix: go lint Signed-off-by: kkk777-7 <[email protected]> * address comments Signed-off-by: kkk777-7 <[email protected]> * feat: support egctl translate options Signed-off-by: kkk777-7 <[email protected]> * update: bench test Signed-off-by: kkk777-7 <[email protected]> * update embedded field Signed-off-by: kkk777-7 <[email protected]> * fix gatewayapi testdata output Signed-off-by: kkk777-7 <[email protected]> --------- Signed-off-by: kkk777-7 <[email protected]> Co-authored-by: zirain <[email protected]> Signed-off-by: Rudrakh Panigrahi <[email protected]> * fix gen-check Signed-off-by: Rudrakh Panigrahi <[email protected]> --------- Signed-off-by: Huabing (Robin) Zhao <[email protected]> Signed-off-by: Rudrakh Panigrahi <[email protected]> Signed-off-by: kkk777-7 <[email protected]> Co-authored-by: Huabing (Robin) Zhao <[email protected]> Co-authored-by: Kota Kimura <[email protected]> Co-authored-by: zirain <[email protected]>
What this PR does / why we need it:
Introduce Translator Context to improve GatewayAPI translator performance.
Now, Gateway API translator methods hold a lot of local maps to improve retrievals.
These can be all moved to a common preprocessing step, saved in the Translator context and reused across methods.
Also each resource is currently retrieved by performing a linear search over
resource.Resources.Therefore, for resources that are accessed frequently, maintaining a map is expected to improve CPU performance.
This PR's scope
Although the following items were initially considered, the improvements were minimal and would increase the complexity, so they were excluded from the scope. Ref : #7535 (comment)
Policy Target Gateway MapPolicy Target Route MapWhich issue(s) this PR fixes:
Fixes #6711
Release Notes: No
Benchmark Detail
gobench result
gatewayapi translator benchmark (vs latest main branch)