ID:2023324
 
So, i heard, that Byond shuts down all traffic/processing, suspending it for 1.5 seconds if the CPU rate goes above a certain amount?

I was wondering, how it calculates the CPU and such, because it seems like when it does this on our VPS, our CPU for the core Byond is assigned is NEVER anywhere near even 50% used, so I'm thinking of writing a by-pass or something for this, if it's specific to our codebase (ss13) and not Byond.

Anyone have help/suggestions?
Apophis775 wrote:
So, i heard, that Byond shuts down all traffic/processing, suspending it for 1.5 seconds if the CPU rate goes above a certain amount?

That's not accurate. There's a full discussion of this in the recent thread in Bug Reports.
Thanks. Like I said, I had only HEARD about this, and I wasn't sure, only that, since one of the last few updates, our server starts CHUGGING (our average population is between 60 and 100).
Chugging is a cause of the issue in question, not a result. I think something else is causing your chugging.
By Chugging, I mean the Daemon, not the actual server.
MSO's report is that once the server gets busy, it suspends map updates and CPU usage typically drops to almost nothing until map updated resume. That doesn't sound like what you're describing.
Ok, let me re-describe what happens:

1. 70+ players
2. Server CPU usage shows in the 80-110 range typically.
3. Server CPU usage on the box, shows typically around 40-60% of the CPU it's assigned (it's assigned as high-priority, with affinity to a core by itself).
4. Server randomly hangs.
tl;dr: If world.cpu hits above 120, byond stops client map updates for 1.6*world.fps ticks (basically 1.6 seconds worth of ticks) causing the appearance of lag. if more ticks over run during this time frame, it would extend the lag. (1.6 seconds of ticks becomes 3.2 seconds if say every tick overran for double.)

This was apparently supposed to scale, only getting to 1.6 seconds under really bad load, but a bug cause it to only do 1.6 seconds, on light overloading and heavy overloading alike.


As a note, world.cpu is calculated as the amount of tick time used over the last 16 ticks. if tick_lag is 0.5, and ticks take 0.4 to process, that's 80% world.cpu.


(it's assigned as high-priority, with affinity to a core by itself).

I should note, that byond does do some multithreading, as it uses an asynchronous network stack, so (without byond really trying) network send/receive happens on another thread. It would be wise to give byond 2 cpus, that are on the same l2 cache package (1&2 or 3&4, etc)