> How many file descriptors per process?
>
> Things other than sockets use file descriptors (like open files) so the
> number of socket connections you can have would be variable.
Makes sense.
> Mac Pro is a mac os X machine, correct? In which case it's a unix
> machine, in which case ulimit -n tells you current file descriptor
> setting.
It reports 256, which is nowhere near my maximum connection number of ~370
I'm willing to test this idea out, but how? Can I change this limit for
the entire operating system? I saw from documentation that changing the
limit only works for the current shell and its descendents, whatever
that means.
How do I see how many file descriptors a program is using?
> Maybe this is the issue. All the best, Opalinski opalpa@gmail.com
Thanks so much!
> http://www.geocities.com/opalpaweb/
opalpa@gmail.com opalinski from opalpaweb - 02 Oct 2006 21:15 GMT
> It reports 256, which is nowhere near my maximum connection number of ~370
> I'm willing to test this idea out, but how? Can I change this limit for
> the entire operating system? I saw from documentation that changing the
> limit only works for the current shell and its descendents, whatever
> that means.
Changing the limit for the shell and its descendents means that when
running your app from a command prompt you can first set the limit for
the shell that is giving you the command prompt and the same limit will
be given to all apps started from that command prompt.
ulimit -S -n 1000 # set limit for shell
java -jar YourApp.jar # start your app which is a descendent of this
shell
Re: change it for OS
I don't know off top for sure on Mac OX. Maybe it is an /etc/system
setting. This should not be too hard to locate on the internet. It's
a common need.
> How do I see how many file descriptors a program is using?
Don't know. Best I can think of:
1) google it
or
2) Check ulimit on computer you have and see if any flags tell you how
many are left. Then you can call that routine from within java, parse
output, and get yourself an answer
Another approach could be that when limit is reached you ask for more.
All the best,
Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
Joshua Jung - 04 Oct 2006 16:01 GMT
I figured it out. Apparently two things were happening:
1. I was running out of memory, and had to up the stack heap size when
running my server from the command prompt (using -Xmx command)
2. I had to up the file descriptor limit to some huge number in the
thousands.
Then everything worked fine and I got like 1600 connections, all with
independent threads to work just fine!
Josh <><
On Mon, 02
>> It reports 256, which is nowhere near my maximum connection number of ~370
>> I'm willing to test this idea out, but how? Can I change this limit for
[quoted text clipped - 32 lines]
> opalpa@gmail.com
> http://www.geocities.com/opalpaweb/