[0.15.4] can't catch up 16% cpu usage

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
British_Petroleum
Filter Inserter
Filter Inserter
Posts: 321
Joined: Tue Dec 23, 2014 7:21 am
Contact:

[0.15.4] can't catch up 16% cpu usage

Post by British_Petroleum »

Hi guys,

So often my PC can't catch up when joining multiplayer games, so i opened task manager while trying to catch up and all cores are using less than 50%. Can someone explain this? I'm assuming this isn't a problem with the game, and I just need a better CPU, but would be nice if there was another solution. I currently have a 3.0 Ghz AMD phenom 2 X6.
Attachments
Capture.JPG
Capture.JPG (64.34 KiB) Viewed 7880 times

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by orzelek »

Game is currently bound to one CPU core for simulation.
Devs experimented with multithreading but all the stuff needed to make it deterministic made potential gains not so big so it's not in 0.15.

For now you need a CPU that has good single core performance for big factories.

You won't see it on graph directly since there is a lot of thread jumping around cores so it looks like all of them are used in balanced way. In your case with 6 cores 16.7% is about one core being used constantly.

nevniv
Inserter
Inserter
Posts: 49
Joined: Wed Sep 21, 2016 1:37 am
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by nevniv »

Hmm.. but he's showing you the graph will all the cores and none are maxed so its not an average. The process would not be jumping evenly between cores. I would not think the bottleneck is the CPU looking at that.

Maybe I am wrong. If you upload the log of the connecting client (you) maybe someone can help out more.

Also has the server operator tried pausing the game to see if it helps you any?

lexx
Inserter
Inserter
Posts: 28
Joined: Mon Jan 02, 2017 10:26 pm
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by lexx »

16-17% ish CPU use is about max the game can use on your 6 thread CPU (1 core =16-17% as it looks like you have a AMD A4 or A6 CPU from the looks of it, so your CPU is probbery to slow) the game is more so single thread limited (divide 100 by thread count to get your per core % and look at processes and sort it by cpu)

more then likely you CPU is just not fast enough to keep up with the server (i assume the save game has a lot of stuff on it) i have that problem late game not been able to keep up with server

basicly you game is going as fast as it can on your CPU (what is the CPU if it a A6 or A4 it will be not be fast enough on larger maps, need a 4th Gen i5 i7 intel CPU or higher CPU to keep up)

nevniv
Inserter
Inserter
Posts: 49
Joined: Wed Sep 21, 2016 1:37 am
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by nevniv »

The OP posted a screenshot of his 6 cores and none of the graphs are anywhere near 100% so I don't know why everyone keeps saying his CPU is maxed...

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by orzelek »

nevniv wrote:The OP posted a screenshot of his 6 cores and none of the graphs are anywhere near 100% so I don't know why everyone keeps saying his CPU is maxed...
Most likely reason is that due to task switching work is not happening constantly only on one core but it's thrown around. That might lead to graph showing that all of cores are slightly used while mostly single threaded task is scheduled on different cores. It's also possible that there are different apps running and Factorio is not occuping one core constantly for some reason (like waiting for renders - I think it's visible in stats under F5 as sleep time).

Loewchen
Global Moderator
Global Moderator
Posts: 8285
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by Loewchen »

nevniv wrote:The OP posted a screenshot of his 6 cores and none of the graphs are anywhere near 100% so I don't know why everyone keeps saying his CPU is maxed...
Because this is what a maxed core of a six core CPU performing loadbalancing looks like. The fact that this particular CPU shares the FPU between core pairs makes it perform particularly bad.

User avatar
TruePikachu
Filter Inserter
Filter Inserter
Posts: 978
Joined: Sat Apr 09, 2016 8:39 pm
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by TruePikachu »

I am able to confirm that the performance being reported is 100% in a single thread. The graphs aren't reliable for determining this due to how the scheduler is moving the thread between each core. Each point on the graph represents an average over the time period the point spans, and the thread is being moved multiple times inside that time period.

I can't be sure (I don't know how FPU waiting time is classified), but it is possible that other running applications are requesting a lot of FPU resources; this would slow down Factorio quite a bit because each pair of cores shares a single FPU, and Factorio can't use the FPU if something else is.

I'm fairly sure that 3GHz should be enough, though; would it be possible to get the savegame from a server which causes this issue, for performance analysis?

lexx
Inserter
Inserter
Posts: 28
Joined: Mon Jan 02, 2017 10:26 pm
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by lexx »

nevniv wrote:The OP posted a screenshot of his 6 cores and none of the graphs are anywhere near 100% so I don't know why everyone keeps saying his CPU is maxed...
factorio is mostly single threaded

lack of understanding of what entails a maxed CPU out when a program is single threaded (sorry but talking about a subject you don't know about or currently not aware of or don't care ) 100 divide by thread count in taskmanager = your single threaded max percentage (8 threads is around 12-13% 6 core is around 16%)

his CPU maxed out for a Single Threaded game witch factorio is ( amd cpu owners apart from RYZEN will have problems keeping up with other players that have 4th Gen intel i5 -i7 CPUs) intel i5-i7 4th gen or RYZEN at around or higher than 3.7Ghz can handle larger maps (up to a point even they will succumb to this problem)

the Phenom x6 is Pre bulldozer CPU, so in this case all 6 cores are actually real full powered cores (still slower then a i7 920 first gen)

lexx
Inserter
Inserter
Posts: 28
Joined: Mon Jan 02, 2017 10:26 pm
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by lexx »

TruePikachu wrote:I am able to confirm that the performance being reported is 100% in a single thread. The graphs aren't reliable for determining this due to how the scheduler is moving the thread between each core. Each point on the graph represents an average over the time period the point spans, and the thread is being moved multiple times inside that time period.

I can't be sure (I don't know how FPU waiting time is classified), but it is possible that other running applications are requesting a lot of FPU resources; this would slow down Factorio quite a bit because each pair of cores shares a single FPU, and Factorio can't use the FPU if something else is.

I'm fairly sure that 3GHz should be enough, though; would it be possible to get the savegame from a server which causes this issue, for performance analysis?
There is more to it then more GHz (your current CPU is close to half as fast as a 4th gen i5)

the only thing you can do is turn the game speed down to 0.5 and then once in start bumping it up until you can't keep up then notch it down again (as anything below RYZEN on the AMD side or intel 4th Gen i7-i5 may have problems with larger maps)

Caennanu
Long Handed Inserter
Long Handed Inserter
Posts: 52
Joined: Fri Mar 17, 2017 4:28 pm
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by Caennanu »

I was having the same issues with my AMD 8320 (of 8230?).
Some things i have found worth doing, if you experience these issues.

1. Set core affinity of factorio.exe to 1 core, preferably not core 0 or 1.(this will help you determine if the cpu is indeed maxxing out)
2. Check your internet adapter settings, make sure the speed & duplex negotiation is set to auto (or full duplex)

Dislaimer: Execution of the following advice might result in defect hardware.

1. Overclock CPU of game machine to about 4ghz
2. Downclock CPU of server to 2.5 - 2.7ghz (or lower if your gaming cpu won't go as high as 4ghz)
3. Remove RAM sticks that have low speed value's
4. Overclock RAM Memory speed (there is a very noticable improvement from 800 to 1333mhz)

nevniv
Inserter
Inserter
Posts: 49
Joined: Wed Sep 21, 2016 1:37 am
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by nevniv »

lexx wrote:
nevniv wrote:The OP posted a screenshot of his 6 cores and none of the graphs are anywhere near 100% so I don't know why everyone keeps saying his CPU is maxed...
factorio is mostly single threaded

lack of understanding of what entails a maxed CPU out when a program is single threaded (sorry but talking about a subject you don't know about or currently not aware of or don't care ) 100 divide by thread count in taskmanager = your single threaded max percentage (8 threads is around 12-13% 6 core is around 16%)

his CPU maxed out for a Single Threaded game witch factorio is ( amd cpu owners apart from RYZEN will have problems keeping up with other players that have 4th Gen intel i5 -i7 CPUs) intel i5-i7 4th gen or RYZEN at around or higher than 3.7Ghz can handle larger maps (up to a point even they will succumb to this problem)

the Phenom x6 is Pre bulldozer CPU, so in this case all 6 cores are actually real full powered cores (still slower then a i7 920 first gen)
I do care, I think what threw me off is the scheduling of the process. I have never seen a process thrown around to different cores quite so often. Seems odd to me.

I am a server administrator, from time to time I'll see a process misbehave (svchost, antivirus, etc.) and consume an entire core and when I look in Task Manager one of graphs depicting the cores would be 100%. The rest would be relatively low. I've never seen a process jump from core to core so rapidly that the percent usage of every graph seems to equal 100 divided by the total number of cores. I also don't typically look at CPU utilization with games open though, and most servers I work on are single-minded so there's less contention between processes I guess.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by orzelek »

nevniv wrote:
lexx wrote:
nevniv wrote:The OP posted a screenshot of his 6 cores and none of the graphs are anywhere near 100% so I don't know why everyone keeps saying his CPU is maxed...
factorio is mostly single threaded

lack of understanding of what entails a maxed CPU out when a program is single threaded (sorry but talking about a subject you don't know about or currently not aware of or don't care ) 100 divide by thread count in taskmanager = your single threaded max percentage (8 threads is around 12-13% 6 core is around 16%)

his CPU maxed out for a Single Threaded game witch factorio is ( amd cpu owners apart from RYZEN will have problems keeping up with other players that have 4th Gen intel i5 -i7 CPUs) intel i5-i7 4th gen or RYZEN at around or higher than 3.7Ghz can handle larger maps (up to a point even they will succumb to this problem)

the Phenom x6 is Pre bulldozer CPU, so in this case all 6 cores are actually real full powered cores (still slower then a i7 920 first gen)
I do care, I think what threw me off is the scheduling of the process. I have never seen a process thrown around to different cores quite so often. Seems odd to me.

I am a server administrator, from time to time I'll see a process misbehave (svchost, antivirus, etc.) and consume an entire core and when I look in Task Manager one of graphs depicting the cores would be 100%. The rest would be relatively low. I've never seen a process jump from core to core so rapidly that the percent usage of every graph seems to equal 100 divided by the total number of cores. I also don't typically look at CPU utilization with games open though, and most servers I work on are single-minded so there's less contention between processes I guess.
AFAIK it might be caused by the fact that Factorio uses Sleep. This would reschedule the thread (since it yields control to operating system) and it would continue on different core potentially. To max one core like you write thread must not yield at all - then it doesn't get rescheduled.

Permittivity
Inserter
Inserter
Posts: 33
Joined: Sun Mar 26, 2017 10:24 pm
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by Permittivity »

Generally a thread should not be jumping around from one core to the next. Performance of a modern CPU depends very heavily on the caching of relevant code and data in the processor's L2 cache. For this reason the operating system's scheduler should try to keep a running thread on the same core as every time the thread gets moved to another core it takes time to repopulate the L2 cache resulting in a performance loss.

If one thread is actually getting smeared across six cores like that, performance is going to be a lot worse than if that thread were to execute on one core.

Atomkraftzwerg
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri Dec 30, 2016 10:00 am
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by Atomkraftzwerg »

Hi dudes,

i have the Problem:

Catch up with the server of a friend takes a few minutes, my Task Manager says me that only 1 "Thread" and not 1 "Core" is used to catch up with factorio.
The Map is without any mods and about to 100MB, my CPU is a new AMD Rayzen 7 1800X with 8 Cores and 16 Threads.
Each Core has 3.60GHz without Boost.

So...WHYYYYY does factorio not use all of the Cores/threads???!!

How will it possible to play larger maps with ONLY ONE THREAD?

that kills the fun to play with other friends, if u make a game with the settings "train world"... i dont know how anyone will launch some satelites or explore all science in this game.


There is no way for factori to get around this problem, factorio needs multicore/multithread/hyperthreading support or it will die quickly...

I want to pay 5€ more if factorio will support all cores of my new AMD Ryzen 7 1800X cpu (kickstarter projekt?)


Sorry that im a little bit in rage, u guys do a great job and we like it how fast u fix the new bugs, i mean 3 patches at one day is awsome.
But please.. Factorio have to support multicore. with an Kickstarter projekt i think u guys can pay a new guy that code´s the multicore support for our Factorio
Attachments
Here is the 100MB map
Here is the 100MB map
100MB Map.jpg (566.36 KiB) Viewed 7627 times
catch up and cpu usage
catch up and cpu usage
Factorio uses 1 Thread for catching up (are u kidding me).jpg (1.93 MiB) Viewed 7627 times

Zeblote
Filter Inserter
Filter Inserter
Posts: 973
Joined: Fri Oct 31, 2014 11:55 am
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by Zeblote »

Atomkraftzwerg wrote:So...WHYYYYY does factorio not use all of the Cores/threads???!!
...because making that work is far more complex than you can imagine.

Atomkraftzwerg
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri Dec 30, 2016 10:00 am
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by Atomkraftzwerg »

I know that is very complex, thats why im saying they need a person who can code it.
With an Kickstarter Projekt they can earn money to pay that person.

If the kickstarter goal is reached, they can hire one to code it.
If the kickstarter is a fail, factorio will not become a multicore support..

No one becomes a problem if kickstarter goal wasnt reached

Zeblote
Filter Inserter
Filter Inserter
Posts: 973
Joined: Fri Oct 31, 2014 11:55 am
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by Zeblote »

Atomkraftzwerg wrote:I know that is very complex, thats why im saying they need a person who can code it.
With an Kickstarter Projekt they can earn money to pay that person.

If the kickstarter goal is reached, they can hire one to code it.
If the kickstarter is a fail, factorio will not become a multicore support..

No one becomes a problem if kickstarter goal wasnt reached
Factorio already sold almost 1 million copies at $20 each, if it was as easy as hiring someone else to do it you can be sure they'd have already done it...

Atomkraftzwerg
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri Dec 30, 2016 10:00 am
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by Atomkraftzwerg »

or they want to save up their money ;)

Marc
Burner Inserter
Burner Inserter
Posts: 12
Joined: Sat May 06, 2017 3:12 am
Contact:

Re: [0.15.4] can't catch up 16% cpu usage

Post by Marc »

A single thread will stay on a single cpu core until it stops for one of a few causes. The most common reason for such a stop is an incorrect branch prediction. When the program branches for one of many reasons, and it does so frequently, the CPU attempts to predict which branch the program will take. Branch prediction is used so the CPU can preemptively load the pipeline with further instructions. If it is correct, it will be able to continue to execute the instructions. If it is wrong, it will have to dump its pipleline and will likely restart with the correct branch on another CPU core. There are other causes for the pipeline to be dumped but branches are the most common.

An endless loop will cause 100% cpu usage may be correctly predicted by the cpu. It would then stay on a single cpu core running it at 100%. From my observation, it is much more common for a single thread running at 100% to be spread over the available cores.

To make a program multithreaded is a substantial undertaking. Sure, the low hanging fruit is anything that has independent data and can be made into separate threads without impact. This is rare in gaming. Most of the time, much effort is required to make the program thread safe in order to prevent issues with shared data. The time required to make the game thread safe is much better used to develop other aspects of the game in my opinion.

For what it's worth, when I select a CPU with gaming in mind, I go for the best single core performance as a top consideration. Not only does this benefit single threaded games, it also benefits multi-threaded games that rely heavily use a small number of threads.

Post Reply

Return to “Technical Help”