i've tried to build a socket server in php, but found out that because of the lack of multithreading capability in php, if the server is loaded with connection (lets say even a small amount of 300 connection), the server will be very slow.
i've switched to java, and built a multithreading socket server, and tried to overloaded it with 100 connection in 10 seconds, and i must say it took it bravely.. my own pc (which made the overload) became real slow during the process but server looked like he was ok.
since i'm building a server which should run lots of connections simultaneously, i'm trying to make efficient, and not to leave any ghost connection open.
there for i'm implementing a "Keep Alive" method and my question is as follow: if i have 600 open connections opened in my server, and obviously it takes the server time to run between all threads to check keep alive and even to get the keep alive message from the client - what should be the appropriate time to check if a keep alive message was sent. i've thought somewhere around 2 minutes - so the server want be to busy, and from the other hand i don't want my clients to send data too often.. any suggestions ?