[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: "optimal" thread number on SMP architecture

Pierangelo Masarati wrote:
It appears that a rough rule of thumb yields 16 * nCPU as the optimal thread number. I've some code that tries to detect the number of CPUs, we could use it to choose the default if not set in slapd.conf. I'm considering a rough algorithm like "threads = min( 16 * nCPU, 64 )". Would this qulify for inclusion?
My instinct is to go with something more like 16 * sqrt( nCPU ); I have yet to see an SMP machine that provides performance scaling linearly with the number of CPUs in threaded apps. And there's also the worry of having all of the process' address space consumed by thread overhead.

I would rather see some mechanism for running multiple slapd processes from the same config and databases. That would reduce some of the concerns about process address space bloat (although I suppose in a 64 bit machine that shouldn't be an issue) as the total number of threads increases. Ideally each process would have its own separate environment cache, though all would share a single lock table.

 -- Howard Chu
 Chief Architect, Symas Corp.  http://www.symas.com
 Director, Highland Sun        http://highlandsun.com/hyc
 OpenLDAP Core Team            http://www.openldap.org/project/