Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Dec 2005 16:18:25 -0700
From:      Greg Lewis <glewis@eyesbeyond.com>
To:        David Xu <davidxu@freebsd.org>
Cc:        Michael Vince <mv@roq.com>, freebsd-java@freebsd.org, performance@freebsd.org, freebsd-threads@freebsd.org
Subject:   Re: More threads
Message-ID:  <20051206231825.GA44966@misty.eyesbeyond.com>
In-Reply-To: <439568FB.1000804@freebsd.org>
References:  <43956122.5020106@roq.com> <439568FB.1000804@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 06, 2005 at 06:33:31PM +0800, David Xu wrote:
> Michael Vince wrote:
[...]
> >But I just can't seem to get past that mark, I have a lot of memory 
> >currently the Tomcat is allocated 2gigs of memory.
[...]
> Number of threads you can create if you use libthr is limited by
> following factors:
> 1) sysctl:
> kern.threads.max_threads_per_proc
> kern.threads.max_groups_per_proc
> 
> 2) stack
> per-thread userland stack, default number on 64 bits platform is 2M,
> on 32 bits platform, it is 1M. I don't know whether java supports
> adjusting default per-thread stack size. if can not, we may add
> an environment variable to thread libraries, for example:
> LIBPTHREAD_THREAD_STACKSIZE allows user to set default stack size.
> 
> Thread also needs a kernel mode stack when it is in kernel, if
> I am right, it is 16K bytes per-thread. if you create too many
> threads, make sure both side won't exhaust address space, and
> because kernel stack can not be swapped out when process is
> running, you'd make sure physical memory can not be exhausted.
> 
> 3) check memory limits
> type limits command:
> 
> Resource limits (current):
>   cputime          infinity secs
>   filesize         infinity kB
>   datasize           524288 kB
>   stacksize           65536 kB
>   coredumpsize     infinity kB
>   memoryuse        infinity kB
>   memorylocked     infinity kB
>   maxprocesses         5547
>   openfiles           11095
>   sbsize           infinity bytes
>   vmemoryuse       infinity kB
> 
> if address space is not large enough, you have to reconfigure kernel
> to allow larger space. Fix me if I am wrong.

I think that Michael's real problem is the amount of memory he has
allocated.  If he has 2GB allocated already then he is out of luck if
he needs to allocate more (e.g. to create another thread).  See mmap(2),
particularly the BUGS section.

-- 
Greg Lewis                          Email   : glewis@eyesbeyond.com
Eyes Beyond                         Web     : http://www.eyesbeyond.com
Information Technology              FreeBSD : glewis@FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051206231825.GA44966>