GitHub user hbdeshmukh opened a pull request:
https://github.com/apache/incubator-quickstep/pull/126
QUICKSTEP-41 Automatically pin workers to CPU cores
- Automatically pin worker threads to CPU cores.
- Use auto pinning when either there are no affinities provided, or the
provided affinities are incorrect.
- Try to balance CPU cores across multiple sockets, when maximum
parallelism is not used.
Shown below is a demonstration of this PR in action.
```
$ numactl --hardware
available: 2 nodes (0-1)
node 0 cpus: 0 1 2 3 4 5 12 13 14 15 16 17
node 1 cpus: 6 7 8 9 10 11 18 19 20 21 22 23
```
The machine has 2 NUMA sockets and 24 CPUs, with 12 CPUS on each NUMA
socket. Next we run Quickstep without any hints on number of workers and their
affinities.
```
$ GLOG_v=1 GLOG_logtostderr=1 ./quickstep_cli_shell
Quickstep expects at least one worker thread, switching to the default
number of worker threads
Starting Quickstep with 24 worker thread(s) and a 21.97 GB buffer pool
Empty worker affinities provided, switching to default worker affinities
Affinities: 0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 12, 18, 13, 19, 14, 20,
15, 21, 16, 22, 17, 23
```
```
$ GLOG_v=1 GLOG_logtostderr=1 ./quickstep_cli_shell -num_workers=24
Starting Quickstep with 24 worker thread(s) and a 21.97 GB buffer pool
Empty worker affinities provided, switching to default worker affinities
Affinities: 0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 12, 18, 13, 19, 14, 20,
15, 21, 16, 22, 17, 23
$ GLOG_v=1 GLOG_logtostderr=1 ./quickstep_cli_shell -num_workers=2
Starting Quickstep with 2 worker thread(s) and a 21.97 GB buffer pool
Empty worker affinities provided, switching to default worker affinities
Affinities: 0, 6
$ GLOG_v=1 GLOG_logtostderr=1 ./quickstep_cli_shell -num_workers=5
Starting Quickstep with 5 worker thread(s) and a 21.97 GB buffer pool
Empty worker affinities provided, switching to default worker affinities
Affinities: 0, 6, 1, 7, 2
```
Right now we don't over-subscribe worker threads to CPU cores. If there are
more workers than the affinities (not recommended anyway), extra workers are
not affinitized to any CPU core.
```
$ GLOG_v=1 GLOG_logtostderr=1 ./quickstep_cli_shell -num_workers=25
Starting Quickstep with 25 worker thread(s) and a 21.97 GB buffer pool
Empty worker affinities provided, switching to default worker affinities
--num_workers is 25, but only specified 24 CPU affinities with
--worker_affinities. 1 workers will be unaffinitized.
Affinities: 0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 12, 18, 13, 19, 14, 20,
15, 21, 16, 22, 17, 23, -1
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/apache/incubator-quickstep auto-worker-pinning
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-quickstep/pull/126.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #126
----
commit 248cec27341fa8f19658d0705c1dca3fec0ff550
Author: Harshad Deshmukh <[email protected]>
Date: 2016-11-04T04:34:37Z
Auto pin workers to CPU cores
- Automatically pin worker threads to CPU cores.
- Use auto pinning when either there are no affinities provided, or the
provided affinities are incorrect.
- Try to balance CPU cores across multiple sockets, when maximum
paralellism is not used.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---