Re: Thread safety and performance
From: Sarge (not_at_home.com)
Date: 01/28/05
- Previous message: mboizeau_at_free.fr: "Re: Oracle Data Provider 9.2"
- In reply to: Kevin Fenters: "RE: Thread safety and performance"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 28 Jan 2005 16:28:04 GMT
"Kevin Fenters" <KevinFenters@discussions.microsoft.com> wrote in message
news:7992E995-D89A-4BD1-9D7C-D79688FEDCA4@microsoft.com...
> Sarge,
>
> My opinion is that one session per thread is the way to go. OLEDB will
> support multi-threaded access to a global or static IDBInitialize* in a
> free-threaded server. I developed a similar thing some time ago, but ran
into
> a problem where one thread managed records that the others depended on. If
> your design creates such a dependency you'll have to serialize multiple
> threads anyway. If you design it with speed in mind, executing commands
with
> parameters is ideal and all that will really happen on executing a command
> will be to transfer the data into a global or static buffer and calling
> ICommand Execute. The command, parameters, columns and buffers need only
be
> "prepared" once. The same holds true for multiple commands per thread if
you
> set them up beforehand and hold them over the lifetime of the threads.
>
> Kevin Fenters
>
Kevin, thanks for your thoughts on this.
I think I can manage the thread serialization by aborting and retrying
transaction-protected updates and inserts that fail due to locking. I'm
already used to doing this with Berkeley DB. For example, if you are
performing an INSERT under ITransactionLocal, it should fail with an
appropriate HRESULT that tells you another thread has already gained
ownership of that portion of the table.
So you feel that prepared commands are more efficient than rowsets. I must
figure out how to reuse prepared commands under transactions. The SDK is
not clear on the scope of transactions. Supposedly, a transaction only
applies to the current session, but I don't know if you have to release and
create the session each time. If so, I would have to prepare all the
commands again.
--Sarge
- Previous message: mboizeau_at_free.fr: "Re: Oracle Data Provider 9.2"
- In reply to: Kevin Fenters: "RE: Thread safety and performance"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|