tags:

views:

492

answers:

4

HTTP protocols work over TCP/IP. SO infact we can say if we connect a client then whether it is TCP or HTTP, a socket is created and hence a file is created. Tomcat works on HTTP.

On TCP I can create 1024 clients simultaneously. If I create more clients then I get Too Many File Open Error. But Using Tomcat I can create more than 14000 clients.

If I use Tomcat then I do not use ulimit to increase my file limit of my OS.

How its possible?

+2  A: 

There's a limit on the number of file descriptors a process is allowed to use. On Unix systems, a socket makes use of a file descriptor.

To get over the 1024 limit of file descriptors, you can use the ulimit command.

diciu
If I use tomcat I do not use ulimit to increase my file limit of OS.
See Stu's answer below - either tomcat is running under a different user and thus has different limits or an ulimit call is part of the tomcat startup scripts.
diciu
+2  A: 

This is a limitation of you Operating System how manny resources may be open. Within *NIX you can controll these Limit with ulimit (http://www.ss64.com/bash/ulimit.html)

HaBaLeS
If I use tomcat I do not use ulimit to increase my file limit of OS.
+3  A: 

My guess is that either...

  1. you are running tomcat with a user (and not your interactive shell, which is restricted) that has a ulimit higher than 1024
  2. your startup.sh script has a ulimit statement within it.

To find out if the later is the case...

grep ulimit ./bin/*

Also, tell us how you are starting tomcat, and we will get to the bottom of this! To see what user your tomcat is running under, try something like this...

ps aux | grep tomcat | cut -d " " -f 1

The output will show use the user name and process id. I'm betting that this is different from what you are running under.

Stu Thompson
I have installed netbeans and managed tomcat. Then I created an application which can create more than 14000 clients then i deploy the application then I ran the application.
I am 99% convinced that you are running tomcat under an account other than your own. I'll update the answer to help show if this is the case or not.
Stu Thompson
A: 

When you say "Using Tomcat I can create more than 14000 clients", what exactly do you mean by "client"?

Is it possible that your application is simulating 14000 concurrent users (each of whom might make, say, 1 HTTP request every 10 seconds to the server, each request takes 0.01 seconds, so tomcat only needs ~14 concurrent connections at any given time?

using netstat -n|grep 8080 will list all the active HTTP connections to your tomcat (assuming you're listening on port 8080, adjust to suit if not). That should let you see how many TCP connections you're really using.

Could you post some more detail of what your load-testing program actually does? That might help understand what you're seeing.

Chris May