Reduce footprint of ScribeClient
authorVladimir Slaykovskiy <vslaykovsky@fb.com>
Fri, 16 Sep 2016 09:53:58 +0000 (02:53 -0700)
committerFacebook Github Bot 0 <facebook-github-bot-0-bot@fb.com>
Fri, 16 Sep 2016 10:08:31 +0000 (03:08 -0700)
commit2adb6eb0cd30c11f58052753f72e1db6bb77f25d
treefb6867b5c96ea6161b0934ffed5e673f3160e1a4
parenta610249b9ea7c414810b1c0a12f9a81c13c834ec
Reduce footprint of ScribeClient

Summary:
I've found all code paths that contributed to the number of threads in new ScribeClient. Here's a list of flags that reduce the number of thread:
  --default_tls_thread_count=1 # was 32
  --sr2_event_base_pool_size=1
  --has_thrift_dispatcher_reporter=0 # creates a thrift server with a few extra threads
  --observer_manager_pool_size=1 # default is 4

Optimizations in this diff:
- Don't initialize OBCClient object if it is not used
- Added FLAG_observer_manager_pool_size to control size of the pool in ObserverManager

Currently OBC counters are switched off globally in ScribeCliean, it means that new code path that creates SR instances is disabled, but eventually we plan to switch it on. Clients that don't use SR and want to keep their RSS/threads profile low, should pass flags listed above. I'll announce this in ScribeUsers group as well.

Differential Revision: D3870704

fbshipit-source-id: 0efad6b3dc43c072ab11cac7e9461c09532ea11c
folly/experimental/observer/detail/ObserverManager.cpp