Freebsd – Increasing FreeBSD threads

freebsdsysctlthreads

For network apps that create one thread per connection (like Pound), threadcount can become a bottleneck on the number of concurrent connections you can server.

I'm running FreeBSD 8 x64:

$ sysctl kern.maxproc
kern.maxproc: 6164

$ sysctl kern.threads.max_threads_per_proc
kern.threads.max_threads_per_proc: 1500

$ limits
Resource limits (current):
  cputime              infinity secs
  filesize             infinity kB
  datasize             33554432 kB
  stacksize              524288 kB
  coredumpsize         infinity kB
  memoryuse            infinity kB
  memorylocked         infinity kB
  maxprocesses             5547
  openfiles              200000
  sbsize               infinity bytes
  vmemoryuse           infinity kB
  pseudo-terminals     infinity
  swapuse              infinity kB

I want to increase kern.threads.max_threads_per_proc to 4096. Assuming each thread starts with a stack size of 512k, what else do I need to change to ensure that I don't hose my machine?

Best Answer

FWIW, I set kern.threads.max_threads_per_proc to 4096 without modifying any other settings and haven't seen any ill effects. Pound even got there a couple times (eating up 2GB of RAM while doing so).

Related Topic