### Motivation

This is part of a set of changes aimed at reducing latency in BK at the expense 
of other aspects (eg: max throughput). While not intended to be used as default 
settings, they might be good to have whenever the latency becomes critical. 

Pinning a thread to a particular CPU will ensure no other process will execute 
on that CPU reducing all scheduler induced context switches that will cause 
latency jittery.

A given thread that wants to get pinned to a CPU just needs to call: 

```java
CpuAffinity.acquireCore();
```

It's called `acquireCore()` because it will also disable hyper-threading on the 
pinned cpu.

Subsequent PRs will use this module to have the option to pin critical threads 
to available CPUs.

### Changes
 * Added JNI module to call `sched_setaffinity()` to pin a thread to a 
particular CPU
 * Automatically discover available isolated CPUs
 * Acquire file-based locks to allow multiple processes on same machine to 
acquire CPUs independently.

[ Full content available at: https://github.com/apache/bookkeeper/pull/1641 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to