Re: [twsocket] NO_ADV_MT and Multithreaded application

2009-12-18 Thread Fastream Technologies
Hello,

We can donate $60 to the coder who can do this until Jan 1st 2010 as
performance is CRITICAL for some of our web reverse proxy customers.
Currently it can answer 10600 requests/sec from cache and looking for even
further improvement! (IIS7 can do 18000 req/s).

Regards,

SZ

On Wed, Dec 16, 2009 at 11:56 AM, Anton Sviridov  wrote:

> Arno, SZ, thanks for your answers!
> Idea of removing some CritSections looks nice, as these sections, I
> suppose, are unnecessary. This will surely increase overall performance.
>
> --
> Anton
> --
> 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
>
--
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


Re: [twsocket] NO_ADV_MT and Multithreaded application

2009-12-16 Thread Anton Sviridov
Arno, SZ, thanks for your answers!
Idea of removing some CritSections looks nice, as these sections, I suppose, 
are unnecessary. This will surely increase overall performance.

-- 
Anton
--
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


Re: [twsocket] NO_ADV_MT and Multithreaded application

2009-12-09 Thread Fastream Technologies
On 12/9/09, Arno Garrels  wrote:
>
> Anton Sviridov wrote:
> > Arno,
> > so your advice is to leave everything as it is?
>
> Currently yes.
>
> My idea however was to introduce a new symbol for SSL
> multi-thread-locking only, i.e. "NO_SSL_MT" and to
> exchange symbol NO_ADV_MT by the new one in the SSL code.
> Then it was most likely possible to define NO_ADV_MT even
> with multiple socket threads as long as winsock won't be
> unloaded until the application shuts down, this can be
> ensured by a call to WSocketForceLoadWinsock.
>
> --
> Arno Garrels


Sounds like a good idea.

SZ
--
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


Re: [twsocket] NO_ADV_MT and Multithreaded application

2009-12-09 Thread Arno Garrels
Anton Sviridov wrote:
> Arno,
> so your advice is to leave everything as it is?

Currently yes. 

My idea however was to introduce a new symbol for SSL 
multi-thread-locking only, i.e. "NO_SSL_MT" and to 
exchange symbol NO_ADV_MT by the new one in the SSL code.
Then it was most likely possible to define NO_ADV_MT even
with multiple socket threads as long as winsock won't be 
unloaded until the application shuts down, this can be 
ensured by a call to WSocketForceLoadWinsock.
  
--
Arno Garrels

--
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


Re: [twsocket] NO_ADV_MT and Multithreaded application

2009-12-09 Thread Arno Garrels
Fastream Technologies wrote:
> 
> I noticed one thing--In my 4-cores machine, when I launch 4-8 worker
> threads, it uses 50% CPU including the client stress tester (
> http://www.fastream.com/webstresstester.php). For using up all the
> cores, I had to open hundreds of threads--could this be related to
> the winsock calls ADV_MT protection?
> 
> You can use the stress tester above and http://www.iqproxyserver.com
> for testing with adjustable number of threads/clients.

I don't know. But it's IMO overkill to enter and leave two critical
sections per winsock call.

--
Arno Garrels
--
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


Re: [twsocket] NO_ADV_MT and Multithreaded application

2009-12-09 Thread Fastream Technologies
Hello,

On Wed, Dec 9, 2009 at 4:08 PM, Arno Garrels  wrote:

> Anton Sviridov wrote:
> > Hello!
> > I'm writing multithreaded VCL application with following structure:
> > - one thread holding a number of sockets receiving data
> > - one server thread to provide remote control
> > - one main TApplication thread, of course
> > All actions with sockets are done within their owner thread.
> >
> > All inter-thread stuff is synchronized by events, PostMessage is used
> > where possible, so I think no issues here.
> >
> > The question: do I need ADV_MT enabled (i.e., NO_ADV_MT defined)? It
> > generates lots of locking/unlocking, which I think are excess in my
> > case. Or it's safer to leave the define as is?
>
> If you have instances of TWSocket or descendant in different threads do
> not define NO_ADV_MT. The SSL code also relies on that symbol.
> However the locking around the winsock library calls are IMO wasted
> processor time. This is necessary only to provide a public library
> unload option which is IMO not required. Why would I want to unload
> a loaded library except on application shutdown?
> Possible race conditions on checking whether DLL handle or procedure
> addresses were assigned or not won't hurt if the library was only
> unloaded on application shutdown, or am I missing the point?
>
> --
> Arno Garrels
>
>
> --
> 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
>

I noticed one thing--In my 4-cores machine, when I launch 4-8 worker
threads, it uses 50% CPU including the client stress tester (
http://www.fastream.com/webstresstester.php). For using up all the cores, I
had to open hundreds of threads--could this be related to the winsock calls
ADV_MT protection?

You can use the stress tester above and http://www.iqproxyserver.com for
testing with adjustable number of threads/clients.

Regards,

SZ
--
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


Re: [twsocket] NO_ADV_MT and Multithreaded application

2009-12-09 Thread Anton Sviridov
Arno,
so your advice is to leave everything as it is?

--
Anton
--
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


Re: [twsocket] NO_ADV_MT and Multithreaded application

2009-12-09 Thread Arno Garrels
Anton Sviridov wrote:
> Hello!
> I'm writing multithreaded VCL application with following structure:
> - one thread holding a number of sockets receiving data
> - one server thread to provide remote control
> - one main TApplication thread, of course
> All actions with sockets are done within their owner thread.
> 
> All inter-thread stuff is synchronized by events, PostMessage is used
> where possible, so I think no issues here. 
> 
> The question: do I need ADV_MT enabled (i.e., NO_ADV_MT defined)? It
> generates lots of locking/unlocking, which I think are excess in my
> case. Or it's safer to leave the define as is?

If you have instances of TWSocket or descendant in different threads do
not define NO_ADV_MT. The SSL code also relies on that symbol.
However the locking around the winsock library calls are IMO wasted
processor time. This is necessary only to provide a public library 
unload option which is IMO not required. Why would I want to unload 
a loaded library except on application shutdown? 
Possible race conditions on checking whether DLL handle or procedure addresses 
were assigned or not won't hurt if the library was only
unloaded on application shutdown, or am I missing the point?

--
Arno Garrels 


--
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


Re: [twsocket] NO_ADV_MT and Multithreaded application

2009-12-08 Thread Anton Sviridov
>ADV_MT enabled (i.e., NO_ADV_MT defined)

I mean, ADV_MT disabled (i.e., NO_ADV_MT defined)

-- 
Anton
--
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


[twsocket] NO_ADV_MT and Multithreaded application

2009-12-08 Thread Anton Sviridov
Hello!
I'm writing multithreaded VCL application with following structure:
- one thread holding a number of sockets receiving data
- one server thread to provide remote control
- one main TApplication thread, of course
All actions with sockets are done within their owner thread.

All inter-thread stuff is synchronized by events, PostMessage is used where 
possible, so I think no issues here.

The question: do I need ADV_MT enabled (i.e., NO_ADV_MT defined)? It generates 
lots of locking/unlocking, which I think are excess in my case. Or it's safer 
to leave the define as is?

Thanks in advance.

-- 
Anton
--
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