Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion source/docs/stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,14 @@ showing the memory layout for a few scenarios of constructing and joining symbol

There are several ways to create hot-path contention looking up stats by name,
and there is no bulletproof way to prevent it from occurring.
* The [stats macros](https://github.com/envoyproxy/envoy/blob/master/include/envoy/stats/stats_macros.h) may be used in a data structure which is constructed in response to requests.
* The [stats macros](https://github.com/envoyproxy/envoy/blob/master/include/envoy/stats/stats_macros.h) may be used in a data structure which is constructed in response to requests. In this
scenario, consider factoring out the symbolization phase using MAKE_STAT_NAMES_STRUCT
in a factory or context during startup, and using MAKE_STATS_STRUCT in the hot-path and during
control-plane updates, so that we do not need to take symbol-table locks. As an example, see
[ClusterInfoImpl::generateStats](https://github.com/envoyproxy/envoy/blob/8188e232a9e0b15111d30f4724cbc7bf77d3964a/source/common/upstream/upstream_impl.cc#L641)
and its
[MAKE_STAT_NAMES_STRUCT](https://github.com/envoyproxy/envoy/blob/8188e232a9e0b15111d30f4724cbc7bf77d3964a/include/envoy/upstream/upstream.h#L646).
invocation.
* An explicit symbol-table lookup, via `StatNamePool` or `StatNameSet` can be
made in the hot path.

Expand Down