Use Envoy cpuset size to set the default number or worker threads#5975
Merged
mattklein123 merged 14 commits intoenvoyproxy:masterfrom Mar 4, 2019
Merged
Use Envoy cpuset size to set the default number or worker threads#5975mattklein123 merged 14 commits intoenvoyproxy:masterfrom
mattklein123 merged 14 commits intoenvoyproxy:masterfrom
Conversation
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:
If
--concurrencyoption is not specified, set the default number of worker threads based on the cpuset of the process. This means that the amount of worker threads is not controlled by the hardware thread count but instead the cpu allocation.For example, if Envoy is started in a Docker container like this, only four worker threads are created if
--concurrencyoption is not specified:The original behavior was that the number of CPU threads in the system would be used to determine the number of worker threads. This number could be very large for servers with multiple physical CPUs and hyperthreading enabled.
This change has a potentially large performance impact, since it changes the default number of threads assigned to Envoy. However, since the original intent of the default concurrency value was to have the number of worker threads matching to the HW capabilities, after this change the Envoy behavior is probably closer to what is expected. Also,
std::thread::hardware_concurrency()docs say that the returned value "should be considered only a hint".There are no tests yet, because I wanted to have some input whether a change like this would be desirable before finalizing the work. Another potential improvement possibility would be monitoring the process cpuset and changing the amount of worker threads dynamically.
Risk Level: Medium
Testing: manual testing with
tasksetanddockerDocs Changes: Yes, explained the change of behavior
Release Notes: Yes