forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pull] main from envoyproxy:main #288
Merged
Merged
Conversation
This file contains 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
…37896) This reverts commit 0e9be24. Signed-off-by: Ryan Northey <[email protected]>
Fix #37839 Signed-off-by: dependency-envoy[bot] <148525496+dependency-envoy[bot]@users.noreply.github.com>
Fix #37812 Signed-off-by: Ryan Northey <[email protected]> Signed-off-by: dependency-envoy[bot] <148525496+dependency-envoy[bot]@users.noreply.github.com>
Fix #37675 Signed-off-by: dependency-envoy[bot] <148525496+dependency-envoy[bot]@users.noreply.github.com>
An LRU cache was introduced to cache `Envoy::Network::Address` instances because they are expensive to create. These addresses are cached for reading source and destination addresses from `recvmsg` and `recvmmsg` calls on QUIC UDP sockets. The current size of the cache is 4 entries for each IoHandle (i.e. each socket). A locally run CPU profile of Envoy Mobile showed about 1.75% of CPU cycles going towards querying and inserting into the `quic::QuicLRUCache`. Given the small number of elements in the cache, this commit uses a `std::vector` data structure instead of `QuicLRUCache`. `QuicLRUCache`, `std::vector`, and `std::deque` were compared using newly added benchmark tests, and the following were the results: QuicLRUCache: ``` ------------------------------------------------------------------------------------------------------------------------- Benchmark Time CPU Iterations ------------------------------------------------------------------------------------------------------------------------- BM_GetOrCreateEnvoyAddressInstanceNoCache/iterations:1000 31595 ns 31494 ns 1000 BM_GetOrCreateEnvoyAddressInstanceConnectedSocket/iterations:1000 5538 ns 5538 ns 1000 BM_GetOrCreateEnvoyAddressInstanceUnconnectedSocket/iterations:1000 38918 ns 38814 ns 1000 BM_GetOrCreateEnvoyAddressInstanceUnconnectedSocketLargerCache/iterations:1000 52969 ns 52846 ns 1000 ``` std::deque: ``` ------------------------------------------------------------------------------------------------------------------------- Benchmark Time CPU Iterations ------------------------------------------------------------------------------------------------------------------------- BM_GetOrCreateEnvoyAddressInstanceNoCache/iterations:1000 31805 ns 31716 ns 1000 BM_GetOrCreateEnvoyAddressInstanceConnectedSocket/iterations:1000 1553 ns 1550 ns 1000 BM_GetOrCreateEnvoyAddressInstanceUnconnectedSocket/iterations:1000 27243 ns 27189 ns 1000 BM_GetOrCreateEnvoyAddressInstanceUnconnectedSocketLargerCache/iterations:1000 39335 ns 39235 ns 1000 ``` std::vector: ``` ------------------------------------------------------------------------------------------------------------------------- Benchmark Time CPU Iterations ------------------------------------------------------------------------------------------------------------------------- BM_GetOrCreateEnvoyAddressInstanceNoCache/iterations:1000 31960 ns 31892 ns 1000 BM_GetOrCreateEnvoyAddressInstanceConnectedSocket/iterations:1000 1514 ns 1514 ns 1000 BM_GetOrCreateEnvoyAddressInstanceUnconnectedSocket/iterations:1000 26361 ns 26261 ns 1000 BM_GetOrCreateEnvoyAddressInstanceUnconnectedSocketLargerCache/iterations:1000 43987 ns 43738 ns 1000 ``` `std::vector` uses 3.5x less CPU cycles than `quic::QuicLRUCache` and performs very slightly better than `std::deque` at small cache sizes. If considering creating a bigger cache size (e.g. >= 50 entries), `std::deque` may perform better and it's worth profiling, though in such a situation, no cache at all seems to perform better than a cache. Risk Level: low Testing: unit and benchmark tests Docs Changes: n/a Release Notes: n/a Platform Specific Features: n/a --------- Signed-off-by: Ali Beyad <[email protected]>
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.1)
Can you help keep this open source service alive? 💖 Please sponsor : )