Re: asychronous OLEDB
- From: "msgroup" <nospam@xxxxxxxxx>
- Date: Wed, 2 May 2007 16:41:42 -0400
Hi, Alberto:
There are two samples available within our OleDBPro at www.udaparts.com to
show you how to do OLEDB asynchronously. The samples have much opened source
code, which may help you figure out asynchronous execution with OLEDB.
MS OLEDB providers and others well support both single- and free-threaded
apartments. You don't need to do marchalling at all if you set worker
threads to MTA. It is actually very simple.
Regards,
"Alberto Demichelis" <AlbertoDemichelis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:7414B544-87D3-4509-AD64-09F5074CE7CA@xxxxxxxxxxxxxxxx
Hi all,
I'm trying to figure out how to make asychronous queries with OLEDB(C++)
for
the
following problem.
My scenarios is this. I have a large real-time simulation server, the
server
handles about 1000 concurrent clients. Because of the nature od the
simulation
all the computation(except network & IO) is done in the same thread. Every
100ms
all slots (clients) get an update get simulated. Occasionally, based on
the
action performed by the client I need to perform a SQL query(SQL server
2005).
Now my problem is this: CPU wise we are more than fine with 100ms/1000
clients only SQL queries generate sporadic spikes(up to 30ms, usualy
around
10ms).
If a client slot stalls for 10ms waiting for OLEDB this is very dangerous;
all slots
are processed one after the other synchronously so if 10 slots stall on
some
DB query, my server timeslice is gone and the simulation will degrade.
My server is mostly written in C++(unmanaged), the simulation logic is
written with a scripting language that supports cooperative
threads(www.squirrel-lang.org) so I was planning to expose my OLEDB
interface
in a way that will perform my query asychronously.
I can then yield my script(each client has a different cooperative thread)
put the pending command in a list and then every 100ms poll for completion
and eventually resume my cooperative thread and process the result/error.
In
this way only the interested slot stalls and the rest of the clients are
unaffected.
My questions are:
Is it possible to perform sn asychronous query? (I guess so I read about
it
but found no sample)
If yes where can I find a sample? (OLEDB C++ also no ATL is fine)
Is it possible to be sure that resulting the recordset of a select is
alredy filled? (in the context of an asychronous query)
Alternatives to OLEDB?
A possible solution would be to create a separated thread and to the asycn
by myself, but because I suspect OLEDB is capable of this already I'd like
to
avoid having to write my own cross thread marshalling etc...
If I'm asking too much and there is already an online source where I can
find my answer pointing me to that would be more than enough.
Thanks for you time
ciao
Alberto Demichelis
.
- Prev by Date: Re: Command Object and IColumnsRowset
- Next by Date: Re: Query regarding Multiple parameter set using OLEDB
- Previous by thread: Re: asychronous OLEDB
- Next by thread: oledb and dates in vb.net 2003
- Index(es):
Relevant Pages
|