Hello,

I have a question to you guys that has programmed ICS in a heavy traffic
environment.., i'm using borland delphi 7 and ICS 5 to make a HTTP Proxy
Server. Then I used webpolygraph (www.web-polygraph.org) to test the result.
The traffic generated by polygraph has following properties :
1. the data/request is on average about 13KB ranging from 4 KB to 50KB
2. Socket opened and closed is about 200 / sec from client-side
3. Total Opened sockets is around 600-1000 for client-side (proxy - client)
4. Connected clients is around 300 unique IP address (around 4 opened
sockets / IP)
 5. Socket opened and closed is about 100 / sec from server-side
6. Total Opened sockets is around 400 for server-side (web server-proxy)
7. Connected server is around 100 unique IP (no socket limitation per IP,
depends on client request)

by benchmarking my proxy using the above config, the polygraph is
experiencing multiple connection error when the request per second increases
around 60, the error is Connection Reset by peer. It's like the program is
starting to overload.. (though i'm not sure it's the case). The CPU usage is
around 90-100% though

I already tried several ways i saw here to improve performance, including
using these registry key

TcpTimedWaitDelay = 30 (make TIME_WAIT sockets alive for 30 seconds only)
MaxUserPort = 65534
MaxHashTableSize = 65536 default 512
MaxFreeTwTcbs = 2000
MaxFreeTcbs = 16000 default 1000
MaxUserPort = 65534
TcpWindowSize = 65535 default 8192
MaxHashTableSize = 512
TcpNumConnections = 1000
NumTcbTablePartitions = 32 default 4

I also increase listenbacklog to an extreme value (around 5000), though i
know it's OS limited. And BTW my program has no blocking operation,
therefore it's running a single thread single process. It is running as a
console app or service application, therefore it doesn't have any forms. I
also used FastMM memory manager, because my program uses a lot of
new/dispose proc.

Because i am trying to find the slow link, i disabled writing to disk, so
the proxy is almost acting like a non caching, but i still have around 270MB
reserved in memory for cache (because new cache entries is saved in memory
using LRU algorithm until the 270MB is reached, then it removes the cache on
the memory from the oldest entries first to maintain 270MB usage).

I'm using windows xp sp1, and win2k3 edition. The win2k3 seems to perform
better, but not much.

using profiler (AQTime4 from www.automatedqa.com ) I found the longest time
for my program is :
1. Getmessage (there's nothing i could done about this do I ?), but it
doesn't make sense
2. DestroyWindow, to overcome this, i changed XSocketAllocateHWnd from
twsocketserver a bit, and add a tqueue in twsocketserver, so that when a new
socket is created it will check the queue, if it's empty it will create a
new window, but if it's not it will use existing window from the queue. And
after the socket is freed, the window [handle] is not destroyed, but
inserted into the queue, unless the queue already has over than 1000 window,
than it will be destroyed.

After optimize destroywindow, the longest time for my program becomes:
1.GetMessage
2.Wsocket_synchronized_connect
3.Wsocket_synchronized_send
4.Wsocket_synchronized_recv

Is the profiler not right ? (this is my first time using it actually). Btw
for those who wants to see the results
http://img97.imageshack.us/img97/2121/aqtimecu8.png

But somehow, i think 70req/sec is ridiculous, the results on web-polygraph
shows even 130 req/sec for a PIII 1000GHz, 2GB Ram computer (running linux
though). My Comp is AMD 2400+,1GB RAM, I hope it should be equal atleast
right ? The mem shouldn't be a factor, because this is still on fill cache
process (i.e no cache hits are expected).

Is there anything else that i miss, that should be noted for high
performance socket apps ? Please share your experience and thoughts..

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

Reply via email to