Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider setting CPU affinity for fdbserver processes #196

Open
alexmiller-apple opened this issue Apr 19, 2018 · 5 comments
Open

Consider setting CPU affinity for fdbserver processes #196

alexmiller-apple opened this issue Apr 19, 2018 · 5 comments

Comments

@alexmiller-apple
Copy link
Contributor

From https://forums.foundationdb.org/t/setting-cpu-affinity-for-fdbservers/84, it was noted that we don't set CPU affinity for any of the processes we start, and there's likely advantages to doing so. It appears once upon a time, we had code in the resolver that would pin itself to a core, but it was commented out, and I agree doing it from fdbmonitor sounds like a better solution.

Implementing this doesn't sound like too much work, and a quick run through a performance test should tell us if it makes any noticeable impact.

@cespare
Copy link
Contributor

cespare commented Apr 19, 2018

I'd guess the difference will be small on an otherwise-unloaded machine unless you manage to make an fdbserver allocate some memory on the wrong NUMA domain. That should definitely cause noticeable overhead.

@davidscherer
Copy link

The performance effects of this sort of tuning tend to be fairly hardware and OS version specific, so I would recommend diverse testing before making this the default behavior out of the box. But an fdbserver parameter (and thus, config file option) to set affinity might be low risk and convenient.

Ideally operating systems should be able to do a reasonable job placing essentially single-threaded programs, even on NUMA machines. But I think setting affinity is a legitimate solution to a particular situation with network card interrupt delivery. It rings a bell for me. There might have been something written on this subject at some point in FDB history, if the Apple team wants to try to dig it up.

@daverosenthal
Copy link

We messed with pinning the network queues to cores, etc. It only made minor differences with highly unusual test workloads. Never a practical improvement. I agree with @davidscherer 's suggestion of adding an option for CPU affinity.

@panghy
Copy link
Contributor

panghy commented Nov 18, 2018

This turns out to be rather significant for us since we use the memory storage engine. Kernel-level automatic NUMA balancing "kernel.numa_balancing" doesn't help us (enough), basically we discovered that hot spots (certain processes would be much hotter CPU-wise than others) are largely the result of the kernel scheduling the process to a node and having memory allocation local to that node and then subsequently moving the process to another node (the latency impacts are significant in that case and difficult to debug).

[fdbserver.4500]
command = /usr/bin/numactl -m 0 -N 0 /usr/sbin/fdbserver

We are directly managing core and memory affinity with numactl hence.

@xumengpanda
Copy link
Contributor

The numactl command can also handle the set-cpu-affinity work.
Unless we want to start a (fdbserver) process on a particular core, it seems using the linux tools to set the affinity is enough.

sfc-gh-tclinkenbeard added a commit to sfc-gh-tclinkenbeard/foundationdb that referenced this issue May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants