Re: Thread safety and performance

From: Sarge (not_at_home.com)
Date: 01/28/05

  • Next message: johndoe1: "Re: Q: what is the relation between DB-Lib, OLE-DB, and ODBC?"
    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


  • Next message: johndoe1: "Re: Q: what is the relation between DB-Lib, OLE-DB, and ODBC?"

    Relevant Pages

    • Re: Thread safety and performance
      ... Not sure about commands being more efficient than a rowset, ... serialize as many transactions against a session as you want. ... session on starting each thread and keep them open for the duration. ... The command, parameters, columns and buffers need only ...
      (microsoft.public.data.oledb)
    • Re: ShellExcute for non EXE files
      ... the question is how to send commands to a ... command window. ... callback mechanism from that DLL that send received text to our app. ... >a TN3270 session that allows me to connect to Mainframe server. ...
      (microsoft.public.vc.mfc)
    • Re: j2ee architecture advice needed
      ... MySQL tables are not transactional. ... transactions. ... You might want to look at the upcomming EJB 2.1 Web Services, ... > utilize stateless session beans, ...
      (comp.lang.java.programmer)
    • RE: CommitBatchSize vs. CommitBatchThreshold for transactional dis
      ... Let's suppose the bar maid on duty tonight is the high IQ type. ... You issue 2 transactions with a varied amount ... large numbers of transactions and commands to the distribution agent. ... CommitBatchThreshold only refers to individual commands outside of a grouped ...
      (microsoft.public.sqlserver.replication)
    • Re: any trick I need to know to use "expect -i"?
      ... My telnet session actually is to connect my debug port. ... It can receive commands, and print out some messages as well. ... my Expect code sill couldn't send my dump command to my debug pot. ...
      (comp.lang.tcl)