Results 1 to 3 of 3
  1. #1
    Sukeshps is offline Member
    Join Date
    Jan 2012
    Posts
    10
    Rep Power
    0

    Default Thread creation limit

    Hi,
    I have a chat based application.
    Im trying to create a tool that can send multiple requests to my chat application. I basically want to test the no. of chat requests the chat application can scale to. For such a load testing tool i created and java program that initiates a chat request. I created threads such that each thread sends a chat request. But the problem is that when i run the tool only about 2000 threads are being created., after which out of memory error is thrown.

    Well this might be because the jvm memory is exhausted. But the interesting part is as below.
    Im running my tool in a unix machine. Once the thread count reaches around 2000 im getting the out of memory exception and the thread creation almost stops. But if i login into the unix machine in a different instance and run the tool again im able to initiate more threads.(Im logging in using putty)

    Is the jvm for each login session assigned a fixed amount of memory? If not then why is it that even after getting an out of memory error im still able to create more threads when the tool is run from a different instance. Please help....

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,015
    Rep Power
    20

    Default Re: Thread creation limit

    Presuming you are talking about two different executions of your tool then yes, they will use two JVMs.

    Not this won't be a terribly good test as your multiple threads will not be interacting with the chat app at the same time, at least only a number of threads equal to the number of cores will. It will test the number of connections, just not load.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    neilcoffey is offline Senior Member
    Join Date
    Nov 2008
    Posts
    286
    Rep Power
    6

    Default Re: Thread creation limit

    Quote Originally Posted by Sukeshps View Post
    Hi,
    Is the jvm for each login session assigned a fixed amount of memory? If not then why is it that even after getting an out of memory error im still able to create more threads when the tool is run from a different instance. Please help....
    Each JVM is allocated its own heap. But it is also allocated its own memory space, which on 32 bit systems is typically limited to 2GB (and out of which the JVM heap among other things is allocated). Then, each thread that you create will use some memory space for its stack. You could try setting a smaller stack size for the threads you create (it's one of the parameters to the Thread constructor), which may allow you to create more threads.

    You could also start up multiple JVMs as you say... if it's working, does it matter terribly much to you to start up a new process for each block of 2,000 threads?

Similar Threads

  1. Regarding thread creation or thread pool for 100 tasks
    By ashishgupta_mca in forum Threads and Synchronization
    Replies: 2
    Last Post: 05-21-2012, 07:57 AM
  2. Replies: 0
    Last Post: 05-18-2012, 01:29 PM
  3. limit session creation
    By leptogenesis in forum Java Servlet
    Replies: 1
    Last Post: 01-22-2012, 04:11 PM
  4. Concurrency in thread creation and execution
    By krishanu in forum New To Java
    Replies: 6
    Last Post: 06-11-2011, 07:04 AM
  5. decimal limit help
    By Newtothis in forum New To Java
    Replies: 3
    Last Post: 11-16-2010, 06:37 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •