Binding Threads to CPU Cores
After SPDK is started and bound to a device, the vhost process of SPDK calls the librbd interface of Ceph to create a device and generates client threads msgr-worker, tp_librbd, and fn_radosclient of the corresponding RBD. These threads need to be bound to CPU cores.
- Create a core binding script.
cd /home vi bondcore.sh
- Add the following content to the script:
1 2 3 4 5 6 7
pid= rm -rf pid ps -T -p `pidof vhost` |grep -E 'tp_lib|radosclient|msg' > pid while read line;do pid=$(echo $line | awk -F " " '{print $2}') taskset -pc 4-12 $pid done < pid
- taskset -pc 4-12 indicates that the Ceph threads are bound to physical CPUs 4 to 12. Change the value based on the actual scenario.
- This script must be executed after a device is created and the VM is started.
Parent topic: Optimization and Enablement