wasphin commented on code in PR #3668:
URL: https://github.com/apache/brpc/pull/3668#discussion_r4390052951


##########
src/bthread/stack.cpp:
##########
@@ -37,6 +38,14 @@ DEFINE_int32(stack_size_large, 8388608, "size of large 
stacks");
 DEFINE_int32(guard_page_size, 4096, "size of guard page, allocate stacks by 
malloc if it's 0(not recommended)");
 DEFINE_int32(tc_stack_small, 32, "maximum small stacks cached by each thread");
 DEFINE_int32(tc_stack_normal, 8, "maximum normal stacks cached by each 
thread");
+DEFINE_int32(bthread_stack_trim_idle_s, 600,

Review Comment:
   Could we default `bthread_stack_trim_idle_s` to `0` and make trimming opt-in?
   
   For production deployments provisioned for peak concurrency, lowering idle 
RSS does not reduce the memory capacity that still needs to be reserved for the 
next peak. Reusing trimmed stacks also requires faulting in and zeroing pages 
again; retaining the virtual mappings does not guarantee that physical memory 
will be available when demand returns.
   
   Reclaiming idle pages can be useful on shared hosts, but the benefit seems 
workload-dependent and may be limited for dedicated instances. Defaulting to 
`0` would preserve the existing stack reuse behavior and let users explicitly 
choose this tradeoff.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to