Q:

40 tcp clients simultaneously - extreme lag

I own a dedicated server at nuxit, which "guarantees" a 20mb connection. I run a game server there which i have programmed myself in java. The game does not consume a lot of memory/cpu/bandwith (simple games like chess), but i need to maintain tcp sockets opened during the user's login and logout.
I already pay more than 100$/month for this dedicated server, and the users experience 5 to 60 seconds lag, once every 10-60 mn. There are between 10 and 40 users at the same time on the server, at the moment.
I really have no experience in this, and in network management, nor dedicated server rental. I only know how to program. I wonder if this is normal, due to routing issues, or congestioning on my host's routers ? Or something else ?
Is it even theoretically possible to have more than 30 seconds lag on an already opened TCP socket ?
I have searched the web for weeks, and never found anything on this topic.
Which tools could I use, and how, to check where the problems come from, and get a result with certitude ? I have never done such a thing so the simpler the better.
Thanks for your help.

A:

I believe more information may be needed to solve this issue.
Are you sure it's a networking issue?
You could find this out with wireshark running in your pc to have a better analysis of what happens in terms of tcp packets when such problem occurs. (to limit the size of the logs you should limit the captured packets to the server in question).
There could be other processes running on the server at the same time, which slow down your application? Depending on your OS you could setup software to monitor variables such as the CPU/mem/IO.
What happens when your application socket closes due to a failure? you could be observing time-out issues, which are solved when your app creates a new socket?
Also, when there is the slowdown that you mention, are you able to establish ssh/ftp/http connections to the server? In other words, does this slowdown affect other things other than your game service?
Hope some of these ideas can prove helpful.

