Thanks for the below.
 
So does ISAPI use IOCP? It automatically creates its own worker threads in the background? If it does, does it work on the rule, creating 2 worker threads per processor?
 
Neil
----- Original Message -----
From: /dev/null
Sent: Thursday, November 17, 2005 3:25 PM
Subject: Re: [msvc] ISAPI programming

 
I indent to have a database pool of about 30 handles ,  and when needed, will grap a free one, use it, then mark it as free again.  All the server app. will be doing is, reading the database records, and creating an HTML, and sending it back, not file transfer needed.
Do yourself a favor. Create a CPool class that has a Get( ) and a Put( ) with a collection class that you would like to use as the member. Whenever you call Get( ) if you have a DB connection, remove it from the collection and hand it back in the return. If you don't have a DB connection, create one and return that. The Put( ) just sticks the DB connection back into the collection. Wrap the collection access with a critical section.
 
This way you will create only the necessary number of DB connections and not one more (what if you only need 10 and not 30?) *and* you are guaranteed to have a DB collection whenever you need one (what if you need 31?). Also the critical section is the fastest single-process lock mechanism.
 
If you want to limit the DB connections to one set number (like 30) you'll need to add a counter that is incremented every time you create a new DB connection. Once you reach 30, you don't create any more - instead you block on an event that is set as soon as a handle is returned to the collection, and then you step into the critical section and get that handle.
I also writing code for a socket IOCP application (run on a different computer), and have created working threads for connection requests. But, I noticed that the ISAPI don't do this (I am new to ISAPI as you have guessed). How does the ISAPI manage many connections?
 
What makes you think ISAPI doesn't use IOCP?
 


_______________________________________________
msvc mailing list
msvc@beginthread.com
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription changes, and list archive.
_______________________________________________
msvc mailing list
msvc@beginthread.com
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for 
subscription changes, and list archive.

Reply via email to