Assigning Roon process to a specific CPU Core

Core Machine (Debian 10_x64/Roon server)

Hello,

I use to assign RoonServer processes to a dedicated core of the CPU (4 cores). I do this by and at each boot using taskset command.
I have to use, for example : taskset -cp 2,3 7992 to assign process ID 7992 to core 2 and 3.

Is there a way to do this automatic at each boot ? I had a look at /opt/RoonServer/start.sh script but I can’t figure where I can ad the taskset command.

Thank you,
Manu

Maybe in /opt/RoonServer/Server/RoonServer
line
exec “$HARDLINK” --debug --gc=sgen --server “$SCRIPT.exe” “$@”

should I change to

exec taskset -c 2 “$HARDLINK” --debug --gc=sgen --server “$SCRIPT.exe” “$@”

??

Why would you want to do this? Surely you want threads distributed across cores?

I’m betting this will end up in #tinkering

Because I like to experiment ?

1 Like

Well, maybe. I didn’t notice this section before.

There’s nothing wrong with #tinkering! :wink:

You may want to take a look at numactl instead as I think taskset will be depreciated one day.

You’ll need to run something along the lines of sudo numactl --cpunodebind=0 /opt/RoonServer/Server/RoonServer.

Edit /opt/RoonServer/start.sh and change the exec command near the bottom of the script. Whether this will work is debatable since roonserver will call the Mono executables and these may well be scheduled by the Linux kernel.

I think I have seen a dealer doing the same thing on a EUR24000 Windows Roon server, and a Roon user doing the same thing (again on Windows) in another forum.

I would group this kind of tweak with things like OS optimizer, underclock, undervolt, etc.

What is the theoretical benefit of doing this?

Not that it’s relevant for your situation, but if you were running windows you could use process lasso from https://bitsum.com for assigning a process to a specific core.
An example: I have room and HQP assigned to the physical cores.
You can run multiple processes real-time without losing stability or responsiveness thanks to process lasso.
Very helpful app and free!

Hi,
Thank, but there is no exec line in /opt/RoonServer/start.sh script. It’s look like the exec command is in /opt/RoonServer/Server/RoonServer

@nugget => The theoretical benefit is to use a core of the CPU that won’t be disturbed by the OS things…

I already done this with MinimServer on a audio NAS and the result was really sensible.

Theoretical is right, since there is no actual practical benefit. Roon Server pre-buffers ~5 seconds of audio to the endpoint. So any minute (or even large) loss of CPU slices won’t affect it. If this was to have any affect, it’d have to be applied to RoonBridge on the endpoint. And even there… it won’t matter.

How do you prevent the OS from using that CPU core though? I mean you can fix the Roon process to it, but you cant be sure the OS wont use it anyway.

EDIT: Personally the only thing I do on my roon server is boost the priority of the Roon process a bit. Since my server is dedicated to Roon and nothing else this doesnt seem to be a disruptive thing to do, but maybe improves reponsiveness etc.

Also, although different cores do run at slightly different clock rates, there’s no predicting which cores will run at a faster (or slower) clock.

What does “disturbed by” mean in this context?

If you look at roonserver.service you’ll see that it calls start.sh. Look for …

if [ $R -eq 122 ]; then
    exec $0 "$@"
fi

I doubt there is any practical benefit. Indeed, performance may be degraded. Why would you want to run all threads on a single core when other cores could be utilise when they’re sitting idle?

Thank Martin,

I change this line to :
exec taskset -c 2 $0 "$@"
And at startup RoonServer is executed on core 2 as expected.
But the very first process :
root 632 0.0 0.0 6640 3208 ? Ss 09:21 0:00 /bin/bash /opt/RoonServer/start.sh
is still on the first core.
Any idea to move in on core 2 at startup ?
Thank you

Hi,
I’d like to do the same on the endpoint ide, but I haven’t the control on it :frowning:

Change roonserver.service in the same way.