Nick Knutov | 28 Jul 2012 16:34
Favicon

nginx, inside openvz CT, worker_cpu_affinity

Hello all,

 > http://nginx.org/en/docs/ngx_core_module.html#worker_cpu_affinity
 >
 > worker_processes    4;
 > worker_cpu_affinity 0001 0010 0100 1000;
 >
 > "Binds worker processes to the sets of CPUs."

Does it make sense inside OpenVZ container?

Will it work if --cpus does not specified in CT config?
How will it work, if --cpus is specified and less then physical cores?
How will it work, if --cpus is specified and CPU has hyper-threading and
1) --cpus less then cpu cores
2) or --cpus less and odd(!) (example: --cpus: 3, physical CPU cores: 4 
+ HT)

--

-- 
Best Regards,
Nick Knutov
Andrey Vagin | 31 Jul 2012 10:52
Favicon

Re: nginx, inside openvz CT, worker_cpu_affinity

Here is an answer from Vladimir Davydov, who maintains scheduler in
vzkernel.

On Tue, Jul 31, 2012 at 10:29:43AM +0400, Vladimir Davydov wrote:
> http://nginx.org/en/docs/ngx_core_module.html#worker_cpu_affinity
>  >
>  > worker_processes    4;
>  > worker_cpu_affinity 0001 0010 0100 1000;
>  >
>  > "Binds worker processes to the sets of CPUs."
> > Does it make sense inside OpenVZ container?
> 
> It never works. CPU affinity masks are ignored inside containers.
Solar Designer | 31 Jul 2012 17:14
Favicon

Re: nginx, inside openvz CT, worker_cpu_affinity

On Tue, Jul 31, 2012 at 12:52:56PM +0400, Andrey Vagin wrote:
> Here is an answer from Vladimir Davydov, who maintains scheduler in
> vzkernel.
> 
> On Tue, Jul 31, 2012 at 10:29:43AM +0400, Vladimir Davydov wrote:
> > http://nginx.org/en/docs/ngx_core_module.html#worker_cpu_affinity
> >  >
> >  > worker_processes    4;
> >  > worker_cpu_affinity 0001 0010 0100 1000;
> >  >
> >  > "Binds worker processes to the sets of CPUs."
> > > Does it make sense inside OpenVZ container?
> > 
> > It never works. CPU affinity masks are ignored inside containers.

I don't know about nginx in particular, but CPU affinity masks certainly
work for me in OpenVZ containers, at least on RHEL5'ish kernels.  I've
just re-tested on this one:

$ uname -mrs
Linux 2.6.18-308.4.1.el5.028stab100.2.owl1 x86_64

Specifically, sched_setaffinity() in custom code (custom patch to Apache's
suEXEC) and libgomp's GOMP_CPU_AFFINITY env var both work just fine.

Vladimir - does your comment apply to some other kernel versions?
RHEL6'ish maybe?  It'd be good to know and be prepared... and it'd be
really unfortunate to lose this functionality when we finally move to
RHEL6'ish kernels (soonish).

(Continue reading)

Vladimir Davydov | 31 Jul 2012 20:41
Favicon

Re: nginx, inside openvz CT, worker_cpu_affinity

[Re-sending as it seems that for some reason the message was not delivered to the list]

On 07/31/2012 07:14 PM, Solar Designer wrote:
> On Tue, Jul 31, 2012 at 12:52:56PM +0400, Andrey Vagin wrote:
>> Here is an answer from Vladimir Davydov, who maintains scheduler in
>> vzkernel.
>> 
>> On Tue, Jul 31, 2012 at 10:29:43AM +0400, Vladimir Davydov wrote:
>>> http://nginx.org/en/docs/ngx_core_module.html#worker_cpu_affinity
>>>> 
>>>> worker_processes    4;
>>>> worker_cpu_affinity 0001 0010 0100 1000;
>>>> 
>>>> "Binds worker processes to the sets of CPUs."
>>>> Does it make sense inside OpenVZ container?
>>> It never works. CPU affinity masks are ignored inside containers.
> I don't know about nginx in particular, but CPU affinity masks certainly
> work for me in OpenVZ containers, at least on RHEL5'ish kernels.  I've
> just re-tested on this one:
> 
> $ uname -mrs
> Linux 2.6.18-308.4.1.el5.028stab100.2.owl1 x86_64
> 
> Specifically, sched_setaffinity() in custom code (custom patch to Apache's
> suEXEC) and libgomp's GOMP_CPU_AFFINITY env var both work just fine.
> 
> Vladimir - does your comment apply to some other kernel versions?
> RHEL6'ish maybe?  It'd be good to know and be prepared... and it'd be
> really unfortunate to lose this functionality when we finally move to
> RHEL6'ish kernels (soonish).
(Continue reading)

Vladimir Davydov | 31 Jul 2012 17:32
Favicon

Re: nginx, inside openvz CT, worker_cpu_affinity

On 07/31/2012 07:14 PM, Solar Designer wrote:
> On Tue, Jul 31, 2012 at 12:52:56PM +0400, Andrey Vagin wrote:
>> Here is an answer from Vladimir Davydov, who maintains scheduler in
>> vzkernel.
>>
>> On Tue, Jul 31, 2012 at 10:29:43AM +0400, Vladimir Davydov wrote:
>>> http://nginx.org/en/docs/ngx_core_module.html#worker_cpu_affinity
>>>   >
>>>   >  worker_processes    4;
>>>   >  worker_cpu_affinity 0001 0010 0100 1000;
>>>   >
>>>   >  "Binds worker processes to the sets of CPUs."
>>>> Does it make sense inside OpenVZ container?
>>> It never works. CPU affinity masks are ignored inside containers.
> I don't know about nginx in particular, but CPU affinity masks certainly
> work for me in OpenVZ containers, at least on RHEL5'ish kernels.  I've
> just re-tested on this one:
>
> $ uname -mrs
> Linux 2.6.18-308.4.1.el5.028stab100.2.owl1 x86_64
>
> Specifically, sched_setaffinity() in custom code (custom patch to Apache's
> suEXEC) and libgomp's GOMP_CPU_AFFINITY env var both work just fine.
>
> Vladimir - does your comment apply to some other kernel versions?
> RHEL6'ish maybe?  It'd be good to know and be prepared... and it'd be
> really unfortunate to lose this functionality when we finally move to
> RHEL6'ish kernels (soonish).

In RHEL5-based kernels we had the notion of virtual cpus: tasks were 
(Continue reading)


Gmane