Improve pulse sleep on busy servers (#4853)#4893
Open
Zephkek wants to merge 1 commit intomultitheftauto:masterfrom
Open
Improve pulse sleep on busy servers (#4853)#4893Zephkek wants to merge 1 commit intomultitheftauto:masterfrom
Zephkek wants to merge 1 commit intomultitheftauto:masterfrom
Conversation
HandlePulseSleep now returns as soon as the sync thread queues work, instead of sleeping busy_sleep_time at the start of every pulse. Mitigates multitheftauto#4853 (high player count chat lag / packet loss with low CPU): with threadnet, the unconditional sleep could cap DoPulse while m_InResultQueue still grew. Replaced with a short 1ms polling loop that exits on PendingWorkToDo. Idle path unchanged (full idle_sleep_time). server_logic_fps_limit remains the hard cap. busy_sleep_time is no longer used on this path (option still parses). Test plan: code review only; needs 600+ player confirmation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HandlePulseSleepreturns as soon as the sync thread queues work, instead of always sleepingbusy_sleep_timefirst.Motivation (#4853)
With threadnet, the old path slept 20 ms (
busy_sleep_time) before checkingPendingWorkToDo. On busy servers (~600 players), this capped the logic thread whilem_InResultQueuekept growing, causing chat lag/loss with CPU still moderate.Change
Replaced the fixed top-of-pulse sleep + tail loop with a ~1 ms polling loop that returns the moment
PendingWorkToDo()is true.idle_sleep_time.server_logic_fps_limitis still the hard cap.idle_sleep_time = 0is now actually 0 (was clamped to 1).busy_sleep_timeis no longer used here. Option still parses and shows in perf info.Test plan
Code review only (
HandlePulseSleep,PendingWorkToDo,GetSleepIntervals). No 600-player test rig, so this needs operator confirmation that logic FPS isn't pinned near1000 / busy_sleep_timeunder sustained inbound queue.Checklist