osm icon indicating copy to clipboard operation
osm copied to clipboard

begin snapshot cache implementation.

Open steeling opened this issue 1 year ago • 5 comments

Leverage the callbacks to register and unregister the proxy from the proxyregistry.

The snapshot cache leverages a Stream ID, and that's all that's provided on the stream closed callback. Because of this, we need to maintain a mapping of the stream ID to the envoy.Proxy. The most logical place to put this is in the proxyRegistry, so we change the mapping from UUID to stream ID.

OnStreamOpen is mostly copy/pasted form the beginning of StreamAggregatedResources

I also now maintain a stream ID on the server itself, for the legacy StreamAggregatedResources, although that will be removed when we migrate to snapshot cache.

Finally, I'm able to delete some unused code after these refactors, including GetProxyFromPod, and the proxy registry's announcement handler, which was only used in the osm-controller on bootstrap certs (which are never issued in the osm-controller, so therefore did nothing)

Part of #2683 Fixes #4950

Signed-off-by: Sean Teeling [email protected]

steeling avatar Aug 03 '22 01:08 steeling

so we change the mapping from UUID to stream ID.

So this is a breaking change when users upgrade OSM, right?

allenlsy avatar Aug 04 '22 16:08 allenlsy

so we change the mapping from UUID to stream ID.

So this is a breaking change when users upgrade OSM, right?

No the mappings are strictly held in memory so it’s recomputed on every restart anyways

steeling avatar Aug 04 '22 16:08 steeling

Codecov Report

Merging #4963 (0530c6d) into main (273d5cd) will decrease coverage by 0.16%. The diff coverage is 15.38%.

@@            Coverage Diff             @@
##             main    #4963      +/-   ##
==========================================
- Coverage   68.35%   68.18%   -0.17%     
==========================================
  Files         220      219       -1     
  Lines       15998    15985      -13     
==========================================
- Hits        10935    10899      -36     
- Misses       5011     5034      +23     
  Partials       52       52              
Flag Coverage Δ
unittests 68.18% <15.38%> (-0.17%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cmd/osm-controller/osm-controller.go 16.87% <ø> (+0.07%) :arrow_up:
pkg/debugger/proxy.go 2.59% <0.00%> (-0.22%) :arrow_down:
pkg/envoy/ads/cache_callbacks.go 0.00% <0.00%> (ø)
pkg/envoy/ads/cache_stream.go 0.00% <0.00%> (-22.81%) :arrow_down:
pkg/envoy/ads/server.go 51.92% <0.00%> (+1.92%) :arrow_up:
pkg/envoy/ads/stream.go 10.33% <0.00%> (-0.04%) :arrow_down:
pkg/envoy/proxy.go 85.18% <60.00%> (-1.49%) :arrow_down:
pkg/envoy/registry/registry.go 100.00% <100.00%> (+7.50%) :arrow_up:
tests/scenarios/helpers.go 72.41% <100.00%> (ø)
... and 2 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Aug 08 '22 16:08 codecov-commenter

Forgive me if I've missed it, but is there a TL;DR on the benefits of using Envoy's snapshot cache and even what that cache is?

keithmattix avatar Aug 08 '22 21:08 keithmattix

Forgive me if I've missed it, but is there a TL;DR on the benefits of using Envoy's snapshot cache and even what that cache is?

I've updated the comment here https://github.com/openservicemesh/osm/issues/2683, let me know if i can provide more context :)

steeling avatar Aug 08 '22 22:08 steeling