envoyproxy/envoy

Allow worker CPU affinity to be set

Open

#14,619 opened on 2021年1月10日

GitHub で見る
 (7 comments) (0 reactions) (0 assignees)C++ (5,373 forks)batch import
area/perfhelp wanted

Repository metrics

Stars
 (27,997 stars)
PR merge metrics
 (平均マージ 8d) (30d で 378 merged PRs)

説明

I was wondering is there any feature/API that could bind the worker to a dedicated CPU? Something like code in tools/perf/bench/epoll-wait.c

if (!noaffinity) {
	CPU_ZERO(&cpuset);
	CPU_SET(cpu->map[i % cpu->nr], &cpuset);

	ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cpu_set_t), &cpuset);
	if (ret)
		err(EXIT_FAILURE, "pthread_attr_setaffinity_np");

	attrp = &thread_attr;
}

ret = pthread_create(&w->thread, attrp, workerfn,
				   (void *)(struct worker *) w);

Thanks~

コントリビューターガイド