I'm doing some tests to evaluate the performance of my application server.
I'm using a tcp socket server on a single thread (dedicated, I don't use
the main thread), connected  with 500 clients installed on different
machines (no clients on the server machine).

What I want to evaluate is the ability of the server to process packets.
For this I configured each client to send about 1000 packets per second
of 4 bytes (about 32Kbps).
I'm using a gigabit switch, so I don't have any bandwidth problem.

In a first test, each client transmits and the server only receives.
In this case, the CPU of the server exceeds 50% (on my dual core
machine), some clients will stop transmitting (WSAEWOULDBLOCK) and if I
analyze the traffic with wireshark, I noticed that the window size of
some of the tcp connections goes to zero.
Letting go of the transmission for several hours, the clients contended
the server. As some clients stopped, the others begin to transmit.
For make worse server performance I also introduced a loop inside the
receive routine like this:
for i: = 0 to 200000 do
  Sleep (0);

I believe that the behavior of the server is correct.

In a second test, however, have meant that the server performs the
routing of packets it receives to other clients.
In this case, I make sure that only few clients transmit data (max 6),
while all receive.

The result I get in this scenario is that clients that stops to trasmit,
will not start more.

The behavior gets worse if data are routed also to the socket from which
the data are coming (in this case the CPU is much higher).
The code I use on OnDataAvailable is:
for i: = 0 to fSS.ClientCount-1 do
  / / If fSS.Client [i] <> TWSocketClient (Sender) then
    if fSS.Client [i]. State = wsConnected then
      fSS.Client [i]. Send (fRxData, lSize)

I would figure out what the best way to route packets.
What I like is that even in this case, clients contended the server
without stalling.

Thanks for the help

Ing. Emanuele Bizzarri
Software Development Department
e-works s.r.l.
41011 - Campogalliano - Modena - Italy 
tel. +39 059 2929081 int. 23
fax +39 059 2925035

e-mail: e.bizza...@e-works.it - http://www.e-works.it
La presente comunicazione, che potrebbe contenere informazioni riservate e/o 
protette da segreto professionale, è indirizzata esclusivamente ai destinatari 
della medesima qui indicati. Le opinioni, le conclusioni e le altre 
informazioni qui contenute, che non siano relative alla nostra attività 
caratteristica, devono essere considerate come non inviate né avvalorate da 
noi. Tutti i pareri e le informazioni qui contenuti sono soggetti ai termini ed 
alle condizioni previsti dagli accordi che regolano il nostro rapporto con il 
cliente. Nel caso in cui abbiate ricevuto per errore la presente comunicazione, 
vogliate cortesemente darcene immediata notizia, rispondendo a questo stesso 
indirizzo di e-mail, e poi procedere alla cancellazione di questo messaggio dal 
Vostro sistema. E' strettamente proibito e potrebbe essere fonte di violazione 
di legge qualsiasi uso, comunicazione, copia o diffusione dei contenuti di 
questa comunicazione da parte di chi la abbia ricevuta per errore o in 
violazione degli scopi della presente. 
This communication, that may contain confidential and/or legally privileged 
information, is intended solely for the use of the intended addressees. 
Opinions, conclusions and other information contained in this message, that do 
not relate to the official business of this firm, shall be considered as not 
given or endorsed by it. Every opinion or advice contained in this 
communication is subject to the terms and conditions provided by the agreement 
governing the engagement with such a client. If you have received this 
communication in error, please notify us immediately by responding to this 
email and then delete it from your system. Any use, disclosure, copying or 
distribution of the contents of this communication by a not-intended recipient 
or in violation of the purposes of this communication is strictly prohibited 
and may be unlawful.

To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to