[SERVER-64594] measure executor task stack high water mark Created: 16/Mar/22  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Billy Donahue Assignee: Backlog - Service Architecture
Resolution: Unresolved Votes: 0
Labels: sa-remove-fv-backlog-22
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-64584 Don't hard-code the connection thread... Backlog
related to SERVER-69905 Improve ServiceExecutorSynchronous wo... Backlog
Assigned Teams:
Service Arch
Operating System: ALL
Participants:

 Description   

Related to SERVER-64584 but totally separate from it is an idea to install, particularly in service executor threads, some instrumentation that can give us some statistics and/or warnings on how much stack is consumed by a callback. Something like

https://github.com/mongodb/mongo/blob/5bbadc66ed462aed3cc4f5635c5003da6171c25d/src/mongo/util/stacktrace_test.cpp#L412

Where we could zero-fill the lower portion of the stack memory, execute the task, and then scan to see where the run of zeros stops, which would traverse all available stack space.

This technique applied naively would in practice cause the kernel to realize all the stack's virtual memory though by incurring page faults. This could be avoided by writing zeros only when the page isn't already full of zeros. We could also get fancy and ask the kernel about which pages of the stack's virtual memory are untouched to save some CPU time and VM stress (maybe via /proc/self/maps and /proc/self/pagemap). For debug builds maybe we don't care about that level of optimization though.


Generated at Thu Feb 08 06:00:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.