envoyproxy/envoy

Allow worker CPU affinity to be set

Open

#14 619 ouverte le 10 janv. 2021

Voir sur GitHub
 (7 commentaires) (0 réactions) (0 assignés)C++ (5 373 forks)batch import
area/perfhelp wanted

Métriques du dépôt

Stars
 (27 997 stars)
Métriques de merge PR
 (Merge moyen 8j) (378 PRs mergées en 30 j)

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~

Guide contributeur