Re: Memory Manager Tests - using 512 Threads



"Hannes Danzl[NDD]" wrote:
>> - if you get more throughput with less memory using 16 threads, why would
>> you want to consider even using 512 threads? Does this suggest that
>> somewhere between 1 and 512 threads there is an optimum value?
>
> In a way I'd say yes. What you see is most likely the fact that a default
> non-blocking TCP server hits a limit of connections it can handle. Adding
> more
> processors will push that limit up. This limit is the reason for all high
> performance TCP servers using IOCP which minimizes the use of threads and
> thus
> swtiching time and contention.

I don't quite follow you, Hannes.

I am handling the same number of connections with 16 as with 512 threads, so
I'm not forced to use 512 threads to handle a high number of connections. I
can also use 4 Threads, if I don't want more than 4 remote functions to be
running at the same time.

I'm not talking about 4 working connections, but 4 remote function calls
being executed. Receiving and Sending of data for any number of connections
can be handled from a single thread with non-blocking communication, same as
with IOCP.

The only difference between IOCP and "standard" non-blocking is that IOCP
issues WSARecv calls to check if there is data available for reading, while
non-blocking receives a message from Windows when data has arrived. I doubt
that IOCP would be able to handle a much higher number of requests, using
the same scenario.

Note that I am using the HTTP protocol (adds some overhead to each request),
client is preparing the request by "constructing the object tree" which is
serialized, compressed and encrypted before being sent to the Server. Then,
Server is encryption, decompressing and deserializing received data to
create the same object tree and make it available to all remote functions
being called. Remote functions then construct another object tree, which is
again serialized, compressed an encrypted before being sent back to the
client.

The highest burden on the CPU is not thread-switching, but
compression/decompression, encryption/decryption and object
serialization/deserialization. If thread-switching had big impact, then
using 512 threads istead of 16 would result in a much higher speed
degradation. I'd say that using 30 times more threads (16 vs. 512) would
result in lot more than 9% performance degradation. Remember that my Server
is handling the exact same number of connections with 16 as with 512
threads.

IOCP was designed by Microsoft to make it easier on developers to implement
high-performance Servers using blocking mode. But, you can achieve the same
performance using non-blocking mode, if your design can handle it.

In any case, I'd be happy to test any Client/Server application in my LAN,
doing similar tasks, to make a direct comparison to the RTC SDK.

--
Danijel Tkalcec
http://www.deltasoft.hr/rtc/author.htm


.



Relevant Pages

  • Re: condvar for win32?
    ... and I did not want to tie that up for anything but I/O. ... > an IOCP queue is limited my the amount of non-paged memory... ... I want to maximize the number of connections, and the number of pending I/O operations the server can handle. ... If you have 50,000 connections and each connection has multiple overlapped sends and recvs going, and perhaps multiple disk reads and writes, well, the non-paged memory becomes a major issue indeed. ...
    (comp.programming.threads)
  • Re: SBS 2003 IIS BASED SERVICES FAIL INTERMITTENTLY
    ... If I read your post correctly, you have a switch where the SBS ... Run DHCP server on your SBS, and set all client machine nics to dynamic. ... Once you have your nics configured, run the Connect to the Internet wizard, ... QUESTION1 - what is REFUSING CONNECTIONS? ...
    (microsoft.public.windows.server.sbs)
  • Re: SBS Exchange 2003: too many "Current Sessions" opened
    ... So far everything is good and now I'm just monitoring my exchange. ... get the SMTP service to stop hanging in the first place. ... won't have dead connections. ... work for now until I put into production new server hardware with sbs 2003 ...
    (microsoft.public.windows.server.sbs)
  • Re: SBS Exchange 2003: too many "Current Sessions" opened
    ... You really should go through the steps I posted and get the SMTP service to stop hanging in the first place. ... You'll be happier, you won't be clubbing your server every day with a kill script, and you won't have dead connections. ... You do *not* need to restart the server, ...
    (microsoft.public.windows.server.sbs)
  • Access 2007->SQL Server2005 "connection was forcibly closed",GNE 1
    ... I have a very big problem connecting an SQL ... changing number of clients using the SQL Server with this frontend at the ... connection pooling or if these connections are separated connections). ...
    (microsoft.public.sqlserver.connect)