envoyproxy/envoy

Allow worker CPU affinity to be set

Open

#14.619 aperta il 10 gen 2021

Vedi su GitHub
 (7 commenti) (0 reazioni) (0 assegnatari)C++ (5373 fork)batch import
area/perfhelp wanted

Metriche repository

Star
 (27.997 star)
Metriche merge PR
 (Merge medio 8g) (378 PR mergiate in 30 g)

Descrizione

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~

Guida contributor