[SERVER-8049] Very short timeout for select() call in net listener eats up CPU time Created: 29/Dec/12  Updated: 22/Jan/13  Resolved: 30/Dec/12

Status: Closed
Project: Core Server
Component/s: Internal Code, Networking, Performance
Affects Version/s: 1.9.2, 2.0.8, 2.1.2, 2.2.2, 2.3.1
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Calvin Owens Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: performance
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux


Issue Links:
Duplicate
duplicates SERVER-2114 Don't use select timeouts for fast co... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Run strace on idle mongod - see 100 select() calls each second. Top will show CPU usage.

Participants:

 Description   

The select() call at src/mongo/util/net/listen.cpp:218 is made with a timeout of 10ms, which is unnecessarily small, and, on one of my machines, results in a constant CPU consumption of >1% when mongod is sitting idle.

Eliminate the timeout altogether: just pass NULL and let select() block until something happens. The timeout specified here is unnecessary, as a timeout simply results in select() being called again.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 30/Dec/12 ]

No problem.

Comment by Calvin Owens [ 30/Dec/12 ]

Sorry for the noise

Comment by Eliot Horowitz (Inactive) [ 30/Dec/12 ]

The timeout loop has multiple purposes, so its not trivial to remove.

Comment by Eliot Horowitz (Inactive) [ 30/Dec/12 ]

See SERVER-2114

Generated at Thu Feb 08 03:16:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.