Add MemoryIdler suppot to IOThreadPoolExecutor
Summary: Idle memory in IO threads. If loop is unused for a period of time, free associated memory, and call epoll again. Had to add a new list of callbacks that don't make the loop nonblocking (i.e. using runInLoop() instead would use the nonblocking version of epoll). Could bake this in to EventBase directly, but that seems like the wrong abstraction, since EventBase doesn't actually control the thread - for example, that approach would also free up memory for stack-allocated EventBases where they are used synchronously by clients. This diff doesn't change IO scheduling at all - current IO work is round robin, so this probably only helps if the whole server is idle (at least until we add smarter scheduling) Test Plan: Based on top of D1585087. fbconfig thrift/perf/cpp; fbmake dbg _bin/thrift/perf/cpp/ThriftServer _bin/thrift/perf/cpp/loadgen -num_threads=100 -weight_sendrecv=1 -cpp2 -async Ran loadgen for a while, watched res memory in top. Stopped loadgen. After ~5 sec, res memory was much reduced. Reviewed By: jsedgwick@fb.com Subscribers: trunkagent, doug, fugalh, njormrod, folly-diffs@ FB internal diff: D1641057 Tasks: 5002425
Showing
Please register or sign in to comment