Hey guys, I’m asking for your help.
I run an empty project on Windows, it consumes 8% -10% CPU. I do a headless assembly, the results are the same.
I made a headless assembly on Linux, I run it on a simple VPS, it consumes 94-100%.
How can I change the build headsles frequency?
Tried Vsync, Update frequency, fixed update frequency. nothing changes the load. what am I doing wrong ?
I see the load values in the task manager (% above), as well as through the profiler.get_cpu_usage() method.
Defold 1.4.2 (latest)
Headless.zip (1.8 KB)
Are you sure the Windows numbers are the same when comparing a normal and a headless build? I would expect you to see the same high CPU values on the Windows build in headless mode.
Headless builds run as fast as possible since there is no vsync to wait for. And with vsync disables you can use the update frequency to control how many update()s you get per second. But the engine will still run at a high speed which explains the high CPU usage.
I’m not sure how well the main loop of the engine is designed to actually really sleep in between updates. @JCash will be able to provide some input here. I totally understand that the needs in a headless build are different from a normal build, especially if the intention is to run the headless build on a cloud server, possibly also running multiple instances on a single machine.
Yes, the load is the same in both cases.
Perhaps the load is not maximum due to the fact that I have 12 cores my PC.
And on the VPS 1 core.
Yes, this is a very important thing.
PS
I think I found a suitable function that can be called directly from lua - socket.sleep. Is it suitable for headless builds?