envoyproxy/envoy

Allow worker CPU affinity to be set

Open

#14.619 aberto em 10 de jan. de 2021

Ver no GitHub
 (7 comments) (0 reactions) (0 assignees)C++ (5.373 forks)batch import
area/perfhelp wanted

Métricas do repositório

Stars
 (27.997 stars)
Métricas de merge de PR
 (Mesclagem média 8d) (378 fundiu PRs em 30d)

Description

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~

Guia do colaborador