Thursday July 16, 2009 This week we had a customer claiming that they were unable to create more then 60,000 processes. This turned out to be due to them tuning max_nproc, maxuprc and maxpid but not setting segkpsize so the system would run out of “memory” before it ran into the resource limits for process.
Tuning segkpsize to 8G resolved it but I just had to see how many processes I could get running on an M8000.
Using these settings in /etc/system:
set segkpsize=0x300000 set pidmax=999999 set maxuprc=999990 set max_nprocs=999999
and a simple forker program:
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int
main(int argc, char **argv)
{
pid_t pid;
int count=0;
while(count < argc == 2 ? 100 : atoi(argv[1]) &&
(pid = fork()) != -1) {
if (pid != 0 ) {
/* Parent */
if (count % 1000 == 0)
printf("%d\n", count);
count++;
} else {
pause();
exit(0);
}
}
if (pid < 0)
perror("fork");
printf("%d\n", count);
}I was slightly disappointed at the result:
$ ./forker 100000 1000 2000 3000 ..... 782000 783000 784000 fork: Resource temporarily unavailable 784956 $
Only 784956 processes, plus the ones already running when the system booted. Trying to count them with ps obviously fails but mdb gives the real count.
# ps -e| wc ksh: cannot fork: too many processes # # echo nproc::print -d | mdb -k 0t785025 #
Someone must have managed to get more.
Except where otherwise noted, this site is
licensed under a Creative Commons License 2.0
This is a personal weblog, I do not speak for my employer.
Hi , how much memory in your M8000?
Posted by rmrf on July 16, 2009 at 05:09 PM BST #
# prtdiag | less
System Configuration: Sun Microsystems sun4u Sun SPARC Enterprise M8000 ServerSystem clock frequency: 960 MHz
Memory size: 229376 Megabytes
Posted by Chris Gerhard on July 16, 2009 at 05:42 PM BST #
but you set segkpsize=0x300000 which means 3*1024*1024* 8-Kbyte pages
That is 24Gbytes . why not use more memory ,you have 229376 Megabytes in total all.
Posted by rmrf on July 17, 2009 at 03:22 AM BST #
That is because segkpsize is validated to be no more than 24Gb see: http://docs.sun.com/app/docs/doc/819-2724/chapter2-150?a=view
So unless I build my own kernel that is as big as it gets.
Posted by Chris Gerhard on July 17, 2009 at 08:04 AM BST #
I squeezed a few more process in by starting from milestone none so that there were a minimum number of system processes running.
# echo nproc::print -d | mdb -k
0t785372
#
and impressed that ps is so fast:
# time ps -e > /dev/null
real 0m14.59s
user 0m2.74s
sys 0m11.84s
#
Posted by Chris Gerhard on July 17, 2009 at 03:21 PM BST #
OK, Thank you Chris
Posted by rmrf on July 19, 2009 at 01:27 PM BST #