Bitsum Community Forum

General Category => Process Lasso => Topic started by: msg7086 on October 30, 2012, 08:48:38 PM

Title: Automatic set affinity for single-thread process. Possible?
Post by: msg7086 on October 30, 2012, 08:48:38 PM
Hi all

I'm experiencing bad performance on a hex-core system while running a single threaded process.

I'd hope that Process Lasso can automatically assign a CPU core for such process (either manually, or by auto-detect, i.e. 16.6% on a hex-core, or 25% on a quad-core)

As far as I can see, the only thing I can do is to set a default affinity for such process.

But sometimes I'd like to run several instances of one process, each takes 16%. Simply set them to the same core is not a good choice for me.

I wonder if it can balance them into different low-load single core automatically.

Thank you.
Title: Re: Automatic set affinity for single-thread process. Possible?
Post by: BenYeeHua on October 31, 2012, 08:10:48 AM
So just running each process with difference user name, and create the watchdog as "processname:username" ;)
http://bitsum.com/forum/index.php/topic,1923.msg9084.html#msg9084
Title: Re: Automatic set affinity for single-thread process. Possible?
Post by: msg7086 on October 31, 2012, 05:45:33 PM
Thanks for the idea

In my case, if I can run a  process with different users, I actually can specify affinity when starting that process, by using "start /affinity:X command".

What I'm looking for, is a watchdog rule for affinity, only that the operation is not "set affinity to CPU core 3 & 4", but "set affinity to any one (or two) low-load core"
Title: Re: Automatic set affinity for single-thread process. Possible?
Post by: BenYeeHua on November 01, 2012, 02:08:23 AM
Oh, so I has no idea for that.
It seen like you has running more than 6 process that using the 6 core, but sometimes some of them will bit the core too much.
So you wanna the other process allocate to other core that having low load automatic by PL.
Title: Re: Automatic set affinity for single-thread process. Possible?
Post by: msg7086 on November 01, 2012, 10:20:05 PM
Well, the actual reason to do this is because sticking to a single core makes a single-thread process running much faster.

For example, you convert a music into mp3 using lame, on a hex-core computer.
If there's no affinity limit, lame.exe will use all 6 cores to run a single thread. The OS will assign 16% of each core time slices to the process, and the process will be rapidly switching among the 6 cores.
Switching among cores will lead to high overhead such as lost of cache and time to switch cpu context.

Force a single-thread process on a specific core will prevent this stupid CPU time schedule, and it will run faster.

In my computer, it'll be 2x~3x speed up.
Title: Re: Automatic set affinity for single-thread process. Possible?
Post by: BenYeeHua on November 02, 2012, 03:13:36 AM
Ya, but after you set affinity for the process, like core 0.
The OS will prevent other processes on that core, except you set the other processes with the same affinity. :)
So it means that, if the core 0 is using 80% by other processes that with all affinity tick(default).
After you set affinity on other process, it will be moved to other core.

Can I know which processor are you using?
Because I has test on the i3-2330M(laptop), it only loss 1-2% if I don't set the affinity.
Maybe with help of the low delay L2.
Quoteprevent this stupid CPU time schedule
Did you try disable Core-Parking?
It also reduce the time to schedule also. ;)
Except you are using older than Windows Vista. ;D
Title: Re: Automatic set affinity for single-thread process. Possible?
Post by: Jeremy Collake on November 03, 2012, 12:59:24 AM
Explore the watchdog options and if none meet your needs a custom feature may be required. I was ill for a couple days so am just getting caught up, but can explore alternate solutions too. I will need to read through this more carefully, I may have another idea. BenYeeHua also gave good advice.
Title: Re: Automatic set affinity for single-thread process. Possible?
Post by: msg7086 on November 03, 2012, 05:08:09 PM
Quote from: BenYeeHua on November 02, 2012, 03:13:36 AM
Ya, but after you set affinity for the process, like core 0.
The OS will prevent other processes on that core, except you set the other processes with the same affinity. :)
So it means that, if the core 0 is using 80% by other processes that with all affinity tick(default).
After you set affinity on other process, it will be moved to other core.

Can I know which processor are you using?
Because I has test on the i3-2330M(laptop), it only loss 1-2% if I don't set the affinity.
Maybe with help of the low delay L2.Did you try disable Core-Parking?
It also reduce the time to schedule also. ;)
Except you are using older than Windows Vista. ;D
I'm on a AMD 1090T which is 6 core 6 threads. And things can be worse on my server which is dual 2620, 12c 24t.
Switching between 2 cores may not consume that much overhead, but with a 6 core CPU (or with 12+ cores) it could be a problem.
(or it's AMD's fault?)

I played around the core-parking and problem didn't solved. I also set the power options to max performance, no good.

And I'm on the new Server 2012, which is Win8 server.

Quote from: Jeremy Collake on November 03, 2012, 12:59:24 AM
Explore the watchdog options and if none meet your needs a custom feature may be required. I was ill for a couple days so am just getting caught up, but can explore alternate solutions too. I will need to read through this more carefully, I may have another idea. BenYeeHua also gave good advice.
I've checked the watchdog rules. And the options after 'then:' includes 'change CPU affinity' but you can only choose a specific value instead of a random / spare core depends on actual CPU usage.

And take care ;)
Title: Re: Automatic set affinity for single-thread process. Possible?
Post by: BenYeeHua on November 03, 2012, 07:39:55 PM
Ya, but most people that I meet are converting and converting and gaming, so they are not facing the same problem.
The only thing that I can think is manual set affinity for each process, as maybe there are no software that can meet your request for now. :)
Title: Re: Automatic set affinity for single-thread process. Possible?
Post by: Jeremy Collake on November 04, 2012, 07:06:50 PM
There are actually some undocumented features already in place that may assist you. One is typing in 'random' for the CPU affinity... this will self 1/2 of available cores.
Title: Re: Automatic set affinity for single-thread process. Possible?
Post by: Jeremy Collake on November 04, 2012, 10:19:03 PM
(updated last post to indicate that 'random' as an affinity will end up selecting 1/2 of available cores, at random) ... may not be exactly what you need, but just so you and others know that is there. I threw that in as a custom request for a user, and can do something similar for you, though I may ask for a small donation to compensate for the time and work. I mean small ;)