[bvar](https://github.com/brpc/brpc/tree/master/src/bvar/) is a counting utility for multi threaded scenario, it stores data in thread local storage which avoids cache bouncing. It is much faster than UbMonitor(a legacy counting utility used inside Baidu) and atomic operations in highly contended scenario. bvar is builtin within brpc, through [/vars](http://brpc.baidu.com:8765/vars) you can access all the exposed bvars, or a very single one specified by [/vars/VARNAME](http://brpc.baidu.com:8765/vars/rpc_socket_count). Check out [bvar](bvar.md) if you'd like add some bvars for you own services. bvar is widely used inside brpc to calculate indicators. bvar is **almost free** in most scenarios to collect data. If you are finding a utility to count and show internal status of a multi threaded apllication, you shoud try bvar at the first time. bvar is not suitable for general purpose counters, the read process of a single bvar have to combines all the TLS data in the threads that the very bvar has been written so that it's very slow(compared to the write process and atomic operations).
[bvar](https://github.com/brpc/brpc/tree/master/src/bvar/) is a counting utility for multi threaded scenario. It stores data in thread local storage to avoid cache bouncing by concurrent modification. It is much faster than UbMonitor(a legacy counting utility used inside Baidu) and atomic operation in highly contended scenario. bvar is builtin within brpc, through [/vars](http://brpc.baidu.com:8765/vars) you can access all the exposed bvars inside the server, or a single one specified by [/vars/`VARNAME`](http://brpc.baidu.com:8765/vars/rpc_socket_count). Check out [bvar](../cn/bvar.md) if you'd like add some bvars for you own services. bvar is widely used inside brpc to calculate indicators and it is **almost free** in most scenarios to collect data. If you are looking for a utility to collect and show internal status inside a multiple threaded apllication, you can try bvar at the first time. bvar is not suitable for general purpose counters, the read process of a single bvar have to combines all the TLS data in the threads that the very bvar has been written so that it's very slow(compared to the write process and atomic operations).