Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a java server running in linux at a specific port that accepts persistent connections for thousands and thousands of users. Recently our clients are not able to connect with a time out error. We suspect the traffic is getting too high but our java log actually shows that not many are connected in per second.

We suspect that could it be that too many are trying at the same time and they are basically dropped at the OS level and therefore the java program never really gets a chance to accept the connection? Is there some sort of log in linux that can show someone trying to hit a socket?

share|improve this question

iptables -I INPUT -p tcp --dport some_port -j LOG then
tail -f /var/log/messages
Afterwards, to see how much data has been hit by that rule: iptables -L -n -v
Or you could run tcpdump and grep out the ports.

share|improve this answer
+1. A slight modification might work better to catch just the new connection attempts: iptables -I INPUT -p tcp --dport some_port -m state --state NEW. Note that unless you're interested in the details of each connection attempt, omitting -j LOG avoids spamming the system log file with lots of unneeded data. – Steven Monday Oct 21 '10 at 21:17

When I have really nasty network problems, I tend to fire up wireshark. For me, there's no better network diagnostic tool when I have to get down to the nitty-gritty details. And don't worry if you can't install it on either source or destination box; you can run tcpdump -w to write packet data to a file on start and/or endpoint, and feed file to wireshark on another box at your convenience.

share|improve this answer
Yup, I'd recommend putting a filter on it like tcpdump -nS dst port <some port> – gravyface Oct 21 '10 at 21:01

Would be good to see precisely what your Java threads are getting at a socket level. At the same time you would want to correlate that with OS network info. Take a look at AppFirst. They can do this kind of thing.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.