[Tutor] TCP server/client application failing. Need some help with the basics!

Anubhav Yadav anubhav1691 at gmail.com
Tue May 12 06:39:23 CEST 2015


    But starting with a multi threaded server is not what I'd

> call starting small. Its quite advanced. I'd start getting
> non multi threaded servers running reliably first. Then
> I'd try adding some threading. As in maybe a dozen
> connections sharing some data source..
>
> Only then would I even consider the extra issues of
> scalability to thousands of connections...
>

I did implemented a small server which could only serve one client at a
time. In fact
after realizing that it is able to serve a single client at a moment, I
decided to go with multithreaded
approach. I just didn't thought of including that single threaded server
code here.


> It may be theoretically possible but when I was designing
> large client server/web based systems I used a rule of thumb
> that said not more than 100 connections per core. So for 5000 connections
> I'd need 50 cores. Allowing one core for the OS to
> run per box that leaves 7 cores per 8-core server, so I need
> 8 servers to handle 5000 connections. For resilience I'd
> add another one (so called N+1 architecture).
>
> Now those servers were all carrying significant processing
> requests not simple ping-like requests, so on that basis I'd
> guess that you don't need 50 cores for your example. But
> it does seem like a lot to ask of a single box. And if you
> intend to extend that to a network model think about the
> load on your network card too. My servers at work all
> had a couple of (gigabit) network cards connected.
>

I agree, but since I am trying to learn, I think I should limit my clients
to 100 rather than 1000 or 5000
per machine? Getting a server of that capacity is difficult for me.


> Too much code for me to read at this time of night, but I
> would try slimming down your testing, at least initially.
> Make sure it works on lower loads then ramp up slowly
> until it breaks.
>

I can relate, I wrote this mail at 2 am in the night and immediately hit
the bed. :)

>
> The other thing I'd consider is the timing of your requests.
> I didn't check but have you a decent gap between requests
> or are all 5000 arriving nearly simultaneously? It may
> be a network configuration issue - the socket/port queue
> simply getting choked to the point where packets time out.
>

I have a time.sleep(1) before sending each requests, from each client.

>

-- 
Regards,
Anubhav Yadav
KPIT Technologies,
Pune.


More information about the Tutor mailing list