Using complete CPU core instead thread
Posted in 2018
Michael asked whether Informix can be made to use a whole physical core per CPU VP rather than one hyper-thread, e.g. by setting affinity to every second logical CPU (aff=(0-10/2)) or by taking alternate hyper-threads offline. Answers: a VP is a single OS process, so it can never span two CPUs; affinity only restricts scheduling, and more parallelism needs more CPU VPs. Martin explained hyper-threading semantics; Lester suggested disabling HT in the BIOS (or via echo 0 > /sys/devices/system/cpu/cpuN/online for the second CPU of each matching 'core id' in /proc/cpuinfo), stressing that benefit depends on workload and must be tested. Martin also noted the server was I/O-bound on two disks holding 3TB, so CPU tuning would likely help little. No measured outcome was reported.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: General Discussion
Hi, is it possible to configure informix to use the whole core per VP instead of only one thread using affinity ? Let's say that now we have cpu=6,aff=(0-5),noage Condidering that there are 2 threads per core, if I configure informix to use only one thread per core, would it use the whole core ? For example: cpu=6,aff=(0-10/2),noage or the other thread would be used sometimes by another application on the machine Or bring offline the every second cpu thread of the core that has a thread attached to informix VP ? Thank you.
Are you using Linux on Intel? In which case, hyper-threading manifests itself as two different core numbers (check /proc/cpuinfo) which you can use with affinity. However you'd need to test whether having two CPU VPs per core in this way is faster than one. If not, what platform (OS and hardware combination) are you using? Ben.
Hi Benjamin, I forgot those important details: I use Linux on Intel. Unfortunately I don't have where to test so I tried to ask here Thank you.
Hi,
I'm not sure I completely understood the original question.
Anyway, here's some (not too much in-depth) explanation that may be helpful:
Informix has a homegrown implementation of multi threading. (This is mainly
because at the time the Posix thread implementation first was not and then not
widely available on the many different platforms where Informix was running
(Sequent, Iris, Data General Unix, SINIX, to name a few). Furthermore, it is
also of some advantage that this homegrown multi threading is non-preemptive
as this allows thread switches at times when they are opportune and less
costly.)
An Informix Virtual Processor (VP) is a UNIX/Linux process (of the oninit
binary) that normally has several threads, but runs only one of these threads
at a time. Therefore, a single VP will utilize only a single CPU at any one
time. If there are more CPUs available in the system, then the way to make
Informix utilize them is to start more VPs, especially the so-called CPU VPs
as they are doing most of the normal work by running the so-called "sqlexec"
threads. With the threads running in a VP being of the homegrown multi
threading implementation, the OS does not really know about them and therefore
does not schedule them concurrently. The OS only knows about the VPs (that are
processes) and schedules those.
Bringing in the concept of Intel HyperThreading (and very similar also
Simultaneous Multi Threading - SMT - on Power) does not change anything of the
above. With HyperThreading enabled, the OS basically sees two CPUs for every
processor core. Therefore it can schedule twice as many processes
concurrently. In order to fully take advantage of this, one would have to
re-configure Informix to run twice as many processes (i.e. VPs).
Now, thing with HyperThreading (as well as SMT) is, that - obviously - it does
not magically create twice as many "real CPUs". What it does is to offer the
OS the possibility to schedule twice as many processes concurrently ... and
then runs certain operations executed by two concurrent processes in parallel,
taking advantage of arcane details of the processor and system architecture
(instruction execution pipeline, etc.). Therefore, the two processes that are
seemingly running concurrently on the two CPUs that the HyperThreading offers
for the same core ... only run partially in parallel. How well this
pseudo-parallelism works out (i.e. how much performance improvement it
creates) depends a lot on how the application is implemented and therefore
normally cannot be predicted with much accuracy. With an application like the
Informix database server it may even considerably depend on the database
applications.
With all this, it hopefully becomes a bit clearer that and why:
- a single Informix VP does not utilize two CPUs concurrently as it is a
single process from the perspective of the OS.
- the Informix affinity configuration cannot make a single VP to utilize two
CPUs concurrently. (Binding a VP to one or several CPUs basically tells the OS
to restrict the scheduling of the process to the specified CPUs.)
- switching on HyperThreading does not automatically double the performance.
- with HyperThreading active, Informix probably should be re-configured to run
more (CPU) VPs in order to take advantage of the HyperThreading.
- doubling the number of Informix VPs for HyperThreading probably is not the
ideal configuration because the processes only run partially in parallel.
Doubling the number of VPs may well overload the system and thus cause some
negative effect on performance.
- the ideal Informix configuration for a system with HyperThreading should be
determined by careful tuning of the individual system using the intended
workload.
Regards, Martin
--
Martin Fuerderer
Informix Development Germany
e-mail: martin.furderer@hcl.com
HCL Technologies Germany GmbH
Frankfurter Ring 17
80807 Munich, Germany
http://www.hcltech.com/de
--DISCLAIMER--
--------------------------------------------------------------------------------
----------------------------
This document is intended for transmission to the named recipient only. If you
are not that person, you should note that legal rights reside in this document
and you are not authorized to access, read, disclose, copy, use or otherwise
deal with it and any such actions are prohibited and may be unlawful. The
views expressed in this document are not necessarily those of HCL Technologies
Ltd. Notice is hereby given that no representation, contract or other binding
obligation shall be created by this e-mail, which must be interpreted
accordingly. Any representations, contractual rights or obligations shall be
separately communicated in writing and signed in the original by a duly
authorized officer of the relevant company.
--------------------------------------------------------------------------------
----------------------------
________________________________
From: ids-bounces@iiug.org <ids-bounces@iiug.org> on behalf of R MICHAEL
<mboncalo@gmail.com>
Sent: Tuesday, February 20, 2018 14:58
To: ids@iiug.org
Subject: Re: Using complete CPU core instead thread [40717]
Hi Benjamin,
I forgot those important details:
I use Linux on Intel.
Unfortunately I don't have where to test so I tried to ask here
Thank you.
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.
::DISCLAIMER::
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------
The contents of this e-mail and any attachment(s) are confidential and
intended for the named recipient(s) only. E-mail transmission is not
guaranteed to be secure or error-free as information could be intercepted,
corrupted, lost, destroyed, arrive late or incomplete, or may contain viruses
in transmission. The e mail and its contents (with or without referred errors)
shall therefore not attach any liability on the originator or HCL or its
affiliates. Views or opinions, if any, presented in this email are solely
those of the author and may not necessarily reflect the views or opinions of
HCL or its affiliates. Any form of reproduction, dissemination, copying,
disclosure, modification, distribution and / or publication of this message
without the prior written consent of authorized representative of HCL is
strictly prohibited. If you have received this email in error please delete it
and notify the sender immediately. Before opening any email and/or
attachments, please check them for viruses and other defects.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------
Hi Martin, Thanks for your detailed response. Why I asked this question? Is because We have lots of CPUs available( real ones) and I can use only a small percentage because of the 3TB database is stored on only 2 disks and I can't take advantage of all those CPUs. So I wanted to use, somehow, the whole CPU core instead of a thread. I needed to know if I take offline every second CPU thread, the remaining online thread will have the computation power of the whole CPU core so that I could use it as Informix VP. Thank you, Michael.
Michael,
It is better to Hyper-threading off in the BIOS then from the command line but
this is how we do it.
Here are some notes from our Informix Performance Tuning class on how to do
this.
To See CPU usage:
cat /proc/cpuinfo
Look for the CPUs that have the same "core id", you want to switch off the
second of each pair
And a script to disable it on our systems.
#############################################################################
## Module: @(#)informix.env 2.0 Date: 01/01/2015
## Author: Lester Knutsen Email: lester@advancedatatools.com
## Advanced DataTools Corporation
#############################################################################
## Disable CPU 4-7 to turn off Hyperthreading
echo 0 > /sys/devices/system/cpu/cpu4/online
echo 0 > /sys/devices/system/cpu/cpu5/online
echo 0 > /sys/devices/system/cpu/cpu6/online
echo 0 > /sys/devices/system/cpu/cpu7/online
#############################################################################
Make sure you are disabling the second of each pair... the cpu numbers may be
different on your system.
Make sure you test, depending on your system it may or may not be faster. One
our training servers, with 4 Physical Cores and 8 Virtual Cores, running 8
oninit CPUVP's on the 4 Physical Cores can be faster then running 8 oninit
CPUVP's on 8 Virtual Cores, it all depends on your workload.
Regards - Lester
On 2/20/18 5:28 PM, R MICHAEL wrote:
> Hi Martin,
>
> Thanks for your detailed response.
> Why I asked this question? Is because We have lots of CPUs available( real
> ones) and I can use only a small percentage because of the 3TB database is
> stored on only 2 disks and I can't take advantage of all those CPUs. So I
> wanted to use, somehow, the whole CPU core instead of a thread.
> I needed to know if I take offline every second CPU thread, the remaining
> online thread will have the computation power of the whole CPU core so that I
> could use it as Informix VP.
>
> Thank you,
> Michael.
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
--
______________________________________________________________________
Lester Knutsen lester@advancedatatools.com
Advanced DataTools Corporation Voice: 703-256-0267 x102
Visit our Web page: http://www.advancedatatools.com
______________________________________________________________________
I agree with Lester that it is better to turn off HyperThreading rather than
turning off individual CPUs (i.e. those additional CPUs that the OS shows as a
result from the HyperThreading being active).
If you have some other application(s) runnning on the system for which you
want HyperThreading to be on ... then you may have no other choice than to
individually turn off the "HyperThreading CPUs" of those cores that you want
to give to the Informix Server. I'm not sure what exactly this then means in
terms of process scheduling (from the perspective of the OS). I think you
somehow will have to test. There are many factors that may influence
performance, beginning with the Linux kernel version, and ending with the
nature of the application workload.
If your system is I/O bound because there is a bottle neck with those two
disks containing 3 TB of data, then optimizing CPU utilization probably has
very little effect on overall performance. If the Informix threads doing the
CPU intensive work are waiting for I/O of data, then they will just do that -
wait for the data (and in the meantime not burn CPU cycles in a useless
manner, fortunately).
Regards, Martin
--
Martin Fuerderer
Informix Development Germany
e-mail: martin.furderer@hcl.com
HCL Technologies Germany GmbH
Frankfurter Ring 17
80807 Munich, Germany
http://www.hcltech.com/de
--DISCLAIMER--
--------------------------------------------------------------------------------
----------------------------
This document is intended for transmission to the named recipient only. If you
are not that person, you should note that legal rights reside in this document
and you are not authorized to access, read, disclose, copy, use or otherwise
deal with it and any such actions are prohibited and may be unlawful. The
views expressed in this document are not necessarily those of HCL Technologies
Ltd. Notice is hereby given that no representation, contract or other binding
obligation shall be created by this e-mail, which must be interpreted
accordingly. Any representations, contractual rights or obligations shall be
separately communicated in writing and signed in the original by a duly
authorized officer of the relevant company.
--------------------------------------------------------------------------------
----------------------------
________________________________
From: ids-bounces@iiug.org <ids-bounces@iiug.org> on behalf of Lester Knutsen
<lester@advancedatatools.com>
Sent: Wednesday, February 21, 2018 20:26
To: ids@iiug.org
Subject: Re: Using complete CPU core instead thread [40726]
Michael,
It is better to Hyper-threading off in the BIOS then from the command line but
this is how we do it.
Here are some notes from our Informix Performance Tuning class on how to do
this.
To See CPU usage:
cat /proc/cpuinfo
Look for the CPUs that have the same "core id", you want to switch off the
second of each pair
And a script to disable it on our systems.
#############################################################################
## Module: @(#)informix.env 2.0 Date: 01/01/2015
## Author: Lester Knutsen Email: lester@advancedatatools.com
## Advanced DataTools Corporation
#############################################################################
## Disable CPU 4-7 to turn off Hyperthreading
echo 0 > /sys/devices/system/cpu/cpu4/online
echo 0 > /sys/devices/system/cpu/cpu5/online
echo 0 > /sys/devices/system/cpu/cpu6/online
echo 0 > /sys/devices/system/cpu/cpu7/online
#############################################################################
Make sure you are disabling the second of each pair... the cpu numbers may be
different on your system.
Make sure you test, depending on your system it may or may not be faster. One
our training servers, with 4 Physical Cores and 8 Virtual Cores, running 8
oninit CPUVP's on the 4 Physical Cores can be faster then running 8 oninit
CPUVP's on 8 Virtual Cores, it all depends on your workload.
Regards - Lester
On 2/20/18 5:28 PM, R MICHAEL wrote:
> Hi Martin,
>
> Thanks for your detailed response.
> Why I asked this question? Is because We have lots of CPUs available( real
> ones) and I can use only a small percentage because of the 3TB database is
> stored on only 2 disks and I can't take advantage of all those CPUs. So I
> wanted to use, somehow, the whole CPU core instead of a thread.
> I needed to know if I take offline every second CPU thread, the remaining
> online thread will have the computation power of the whole CPU core so that
I
> could use it as Informix VP.
>
> Thank you,
> Michael.
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
--
______________________________________________________________________
Lester Knutsen lester@advancedatatools.com
Advanced DataTools Corporation Voice: 703-256-0267 x102
Visit our Web page:
https://apac01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.advancedat
atools.com&data=02%7C01%7Cmartin.furderer%40hcl.com%7C65f34282e7ae4164dc2208d579
611983%7C189de737c93a4f5a8b686f4ca9941912%7C0%7C0%7C636548380326823313&sdata=w9H
IRN1ADeoV8rzM3UyjXvR6KOowB60EqSY%2FXiBql0k%3D&reserved=0
______________________________________________________________________
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.
::DISCLAIMER::
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------
The contents of this e-mail and any attachment(s) are confidential and
intended for the named recipient(s) only. E-mail transmission is not
guaranteed to be secure or error-free as information could be intercepted,
corrupted, lost, destroyed, arrive late or incomplete, or may contain viruses
in transmission. The e mail and its contents (with or without referred errors)
shall therefore not attach any liability on the originator or HCL or its
affiliates. Views or opinions, if any, presented in this email are solely
those of the author and may not necessarily reflect the views or opinions of
HCL or its affiliates. Any form of reproduction, dissemination, copying,
disclosure, modification, distribution and / or publication of this message
without the prior written consent of authorized representative of HCL is
strictly prohibited. If you have received this email in error please delete it
and notify the sender immediately. Before opening any email and/or
attachments, please check them for viruses and other defects.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------
Hi Lester,
My ideea was to run the oninit processes on 10 cores by turning off every
second thread (1,3,5,7..) and run ids with affinity 0-18/2 and leave the other
CPU cores threaded to better handle the other small
linux/applicationprocesses. and turning off hyper-threading would be a hastle
since we're not in charge of that and I don't have enough time to test this
Thank you,
Michael.
Hi Martin, You are completely right but unfortunately we have to work with what we receive and I must work with this design. Probably we'll have to add more resources to counter the I/O bottleneck, but this CPU tuning ideea could be a first small step and that's why I wanted opinions on this since I've never heard about this kind of "tuning" Thank you, Michael.