cancel
Showing results for 
Search instead for 
Did you mean: 

Managing Processor Affinity for Better Performance

MowTin
Expert Trustee
Hi,

I recently had a huge problem where a certain game (IL-2) would suffer massive stuttering. I could see that OSVServer_64.exe was increasing activity when these stutters happened. 

I solved this problem by setting CPU affinity for all the Oculus background processes to my last 4 cores. I googled and found others who solved performance problems this way. 

Why was it that IL-2 had this problem and not other games? IL-2 is a simulator that is very demanding on the CPU. So, poor management of CPU cores probably affects all games. 

I heard Process Lasso is a good tool for managing CPU affinity. Any other suggestions? Has anyone else experienced this performance impact of changing CPU affinity? 
i7 9700k 3090 rtx   CV1, Rift-S, Index, G2
8 REPLIES 8

Sneakygloworm
Expert Protege
Wow I used cpu affinity absolutely years ago for an old hp lovecraft game. But it really was years ago. Cpu affinity really shouldn't be something the end user has to implement. Performance issues should be cleared up by the developer during beta testing. Cpu affinity shouldn't be the first thing a user thinks of if he/she has performance issues. Il2 uses an ancient engine? so that may be part of the issue. 

MowTin
Expert Trustee


Wow I used cpu affinity absolutely years ago for an old hp lovecraft game. But it really was years ago. Cpu affinity really shouldn't be something the end user has to implement. Performance issues should be cleared up by the developer during beta testing. Cpu affinity shouldn't be the first thing a user thinks of if he/she has performance issues. Il2 uses an ancient engine? so that may be part of the issue. 

How do devs manage CPU affinity?

Different users have different CPU's with different number of cores running different processes? How would they know that the Oculus processes would interfere with their game? 

I'm guess that CPU affinity is only a problem when you're running a CPU intensive process that would benefit from having fewer processes running in the same core. 

Or maybe, Oculus Home is smart enough to run in different cores than the cores it uses for games. But if I'm using Steam VR, it treats Steam VR as a game and the process that SteamVR spawns can end up running on the same cores that Oculus Home and background processes are using. 
i7 9700k 3090 rtx   CV1, Rift-S, Index, G2

Anonymous
Not applicable
For some reason I am not seeing that issue in IL-2, it is very smooth for me.

Sneakygloworm
Expert Protege

MowTin said:



Wow I used cpu affinity absolutely years ago for an old hp lovecraft game. But it really was years ago. Cpu affinity really shouldn't be something the end user has to implement. Performance issues should be cleared up by the developer during beta testing. Cpu affinity shouldn't be the first thing a user thinks of if he/she has performance issues. Il2 uses an ancient engine? so that may be part of the issue. 

How do devs manage CPU affinity?

Different users have different CPU's with different number of cores running different processes? How would they know that the Oculus processes would interfere with their game? 

I'm guess that CPU affinity is only a problem when you're running a CPU intensive process that would benefit from having fewer processes running in the same core. 

Or maybe, Oculus Home is smart enough to run in different cores than the cores it uses for games. But if I'm using Steam VR, it treats Steam VR as a game and the process that SteamVR spawns can end up running on the same cores that Oculus Home and background processes are using. 


You're exactly right. The developer didn't know when they wrote the game engine but end users should know even less about these things. It's a workaround that the dev needs to patch out or prep for in an old engine update. Multi core cpu's aren't anything new and haven't been for a number of years. What you've found is a correct workaround but what i'm saying is that these issues very rarely crop up now so don't rely on the cpu affinity fix too much in modern game engines as it shouldn't be needed these days. 

Edit - In an ideal world, we would be using 5 or 6 ghz single or dual core cpu's for games but intel insist on developing  28 cores for the home user. God only knows why. Sales pitch - more is better. 

Edit Edit -  What I tend to notice on a 6 core Ryzen is all cores working around 60 to 70% during a session with Elite Dangerous. But the Gpu is running at full bore. Not too bad, I'd prefer the load shared by both. I've transcoded Video before and the software only uses a single core at 100% leaving 5 cores and all the threads idle. Not efficient. 

Its all very complicated for me but I kinda try to see it how it is. If the cpu isn't running at 100% on all cores it's either not needed or it's phat and lazy (programming). We could chat all night about the best way to do things and i wish i could write a little BAT.exe that forced all cores and threads to run simultaneously at 100% (alongside the OS) to see how easy/difficult it would be. Modern programmers should be able to identify and predict core and thread use and program for it. It really shouldn't be an issue these days but it's one that people still find aggravating to this day. I apologise if this seems like a naive view but it is something that people still talk about even now. If your pc is running a game plus Oculus home plus plex plus photoshop and also trying to recode video then yes, there is need for large amounts of hardware  resources but we don't do that. Gamers pc's are primed for performance so programmers and developers should account for it. Pin the cpu down and use as much of it as possible in development.

Lubermatz
Honored Guest
Hello MowTin, I have similar issue on IL2. I want to ask you if you changed affinity to the game process too. And if the setting for VR process is cores n 4, 5, 6 and 7.
Thank you in advande.

MowTin
Expert Trustee

Lubermatz said:

Hello MowTin, I have similar issue on IL2. I want to ask you if you changed affinity to the game process too. And if the setting for VR process is cores n 4, 5, 6 and 7.
Thank you in advande.

I didn't change the affinity for il2. Just the Oculus processes. Yes, I set them to the last 4 virtual cores I had. 

It seems once you set the affinity, it remains even after reboot. I haven't had any problem after that. 

Another change I made is set my Nvidia profile for IL-2 to power management: prefer maximum performance and virtual reality pre-rendered frames to 1. 

My problem was that the game was freezing and I noticed in task manager that OSVRServer was active whenever I would get these massive freezes. 
i7 9700k 3090 rtx   CV1, Rift-S, Index, G2

Admiral-Awesome
Honored Guest
I don't know why the conversation so far has just been "developers" or "users" because the scheduler doesn't lie in either, it's the OS. If there's an issue that setting affinity is sorting, it's because the scheduler is not doing its job. A good reason why affinity is fixing the issue is that when something else runs on the same core as the Oculus processes, it's taking up the cache that Oculus needs. When given it's own core, it's free to have its own cache to use.

MowTin
Expert Trustee


I don't know why the conversation so far has just been "developers" or "users" because the scheduler doesn't lie in either, it's the OS. If there's an issue that setting affinity is sorting, it's because the scheduler is not doing its job. A good reason why affinity is fixing the issue is that when something else runs on the same core as the Oculus processes, it's taking up the cache that Oculus needs. When given it's own core, it's free to have its own cache to use.

I'm guessing here but maybe the OS is getting confused because you have the Oculus process, Steam VR process and whatever game you're running on Steam VR. You don't usually have so many processes working together.  
i7 9700k 3090 rtx   CV1, Rift-S, Index, G2