472,139 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,139 software developers and data experts.

Maximum number of Threads

I'm developing a simple Java client that runs over a CORBA server.
The main client thread is waiting for notification from this server.
On each notification,
The client creates a new thread executing some logic with the server and close.
Each session spend most of the time waiting for the server.
At most there can be ~1000 open session.
My questions are:
1. How many threads can be open at the same time
(with response time of up to ~1 second)?
2. Does the JVM open a native thread for each java thread?

I know both question is OS and JVM dependent,
so I'm not expecting exact numbers here. The client will probably run on Solaris or NT.

Thanks.
Jul 17 '05 #1
5 30545
"Tzach" <tz***@phonedo.com> wrote in message
news:m1************@netra01.phonedo.co.il...
I'm developing a simple Java client that runs over a CORBA server.
The main client thread is waiting for notification from this server.
On each notification,
The client creates a new thread executing some logic with the server and close. Each session spend most of the time waiting for the server.
At most there can be ~1000 open session.
My questions are:
1. How many threads can be open at the same time
(with response time of up to ~1 second)?
2. Does the JVM open a native thread for each java thread?

I know both question is OS and JVM dependent,
so I'm not expecting exact numbers here. The client will probably run on Solaris or NT.
Thanks.


On the first question, I've had upwards of 7000 threads running
simultaneously on Win XP Home before I got an OutOfMemoryException. I never
tried changing the memory usage from the command line, though.
Jul 17 '05 #2
"Tzach" <tz***@phonedo.com> wrote in message
news:m1************@netra01.phonedo.co.il...
I'm developing a simple Java client that runs over a CORBA server.
The main client thread is waiting for notification from this server.
On each notification,
The client creates a new thread executing some logic with the server and close. Each session spend most of the time waiting for the server.
At most there can be ~1000 open session.
My questions are:
1. How many threads can be open at the same time
(with response time of up to ~1 second)?
2. Does the JVM open a native thread for each java thread?

I know both question is OS and JVM dependent,
so I'm not expecting exact numbers here. The client will probably run on Solaris or NT.
Thanks.


On the first question, I've had upwards of 7000 threads running
simultaneously on Win XP Home before I got an OutOfMemoryException. I never
tried changing the memory usage from the command line, though.
Jul 17 '05 #3
Tzach <tz***@phonedo.com> wrote in message news:<m1************@netra01.phonedo.co.il>...
I'm developing a simple Java client that runs over a CORBA server.
The main client thread is waiting for notification from this server.
On each notification,
The client creates a new thread executing some logic with the server and close.
Each session spend most of the time waiting for the server.
At most there can be ~1000 open session.
My questions are:
1. How many threads can be open at the same time
(with response time of up to ~1 second)?
AFAIK this is OS dependent. I'm not aware that Java has a limit, but
your OS probably does.
2. Does the JVM open a native thread for each java thread?


Depends upon the implementation you are running, but many JVM's are
very close to the OS when it comes to threading, so the number of
threads used by your application will probably match the number of OS
threads running (don't forget to include Java's own threads like the
garbage collector!)
-FISH- ><>
Jul 17 '05 #4
Tzach <tz***@phonedo.com> wrote in message news:<m1************@netra01.phonedo.co.il>...
I'm developing a simple Java client that runs over a CORBA server.
The main client thread is waiting for notification from this server.
On each notification,
The client creates a new thread executing some logic with the server and close.
Each session spend most of the time waiting for the server.
At most there can be ~1000 open session.
My questions are:
1. How many threads can be open at the same time
(with response time of up to ~1 second)?
AFAIK this is OS dependent. I'm not aware that Java has a limit, but
your OS probably does.
2. Does the JVM open a native thread for each java thread?


Depends upon the implementation you are running, but many JVM's are
very close to the OS when it comes to threading, so the number of
threads used by your application will probably match the number of OS
threads running (don't forget to include Java's own threads like the
garbage collector!)
-FISH- ><>
Jul 17 '05 #5
You are right in saying this is both JVM and OS dependent. Its been some
time since I worked with threads, so here is what my memory serves me

I think in your situation what you might need is a Thread que and submit
jobs to this que as they come in. It would definately be a more controlled
approach in your client app. Usually there is a limit (based on OS, JVM
hardware etc) after wich the JVM performance drops dramatically. I have seen
this happen on one of my past projects. The server came to a screching halt
after around 300+ threads, but this was back in 98. Both hardware, OS and
JVMs have evolved since then.

Now about Threads JVM and OS
JVM, There are green_thread and native_thread JVMs
There is also np-threads implementation (I think from IBM) where in n native
threads map to p number of JVM threads (I think the JDK1.4 mixed-mode JVM is
of this type).
Then comes the OS, I belive linux has a per process restriction (built into
the kernel) of around 128 native threads (I don't recall the exact number).

If a JVM is spawning native thread for every thread in the JVM then the
performace is based on the OS, behaviour, number and everything else is
dependent on the OS. Native threads are better in performance than
green_threads implementation where the JVM manages its own threads. On the
other hand greenthreads behave exactly the same on multiple platforms, since
the JVM is managing them.

cheers
Haider
"Ryan Stewart" <zz********@gSPAMo.com> wrote in message
news:8p********************@texas.net...
"Tzach" <tz***@phonedo.com> wrote in message
news:m1************@netra01.phonedo.co.il...
I'm developing a simple Java client that runs over a CORBA server.
The main client thread is waiting for notification from this server.
On each notification,
The client creates a new thread executing some logic with the server and close.
Each session spend most of the time waiting for the server.
At most there can be ~1000 open session.
My questions are:
1. How many threads can be open at the same time
(with response time of up to ~1 second)?
2. Does the JVM open a native thread for each java thread?

I know both question is OS and JVM dependent,
so I'm not expecting exact numbers here. The client will probably run on

Solaris or NT.

Thanks.


On the first question, I've had upwards of 7000 threads running
simultaneously on Win XP Home before I got an OutOfMemoryException. I

never tried changing the memory usage from the command line, though.

Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Kums | last post: by
3 posts views Thread by Raghu Rudra | last post: by
4 posts views Thread by Amir Shitrit | last post: by
12 posts views Thread by Paul Sijben | last post: by
5 posts views Thread by linda.chen | last post: by
6 posts views Thread by =?Utf-8?B?U2hhcm9u?= | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.