Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Completion Ports and ODBC

Completion Ports and ODBC

Scheduled Pinned Locked Moved C / C++ / MFC
databasequestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dave B
    wrote on last edited by
    #1

    Im dipping my toe into the murky waters of i/o completion ports.:confused: My app presently use threads to handle client connections , on for each connection. Naturally i now want to use i/o completion ports. Internally i do a lot of database access using odbc. Is there any way to link a SQLExec statement to a completion port ? Theres lots of examples of using sockets but nothing about databases. Doing an async read still involves polling to test the status of the executing statement, which will still mean using multiple threads. I cant believe theres not support for this but ,as ever, the MS docs are very light on the subject. Dave

    N 1 Reply Last reply
    0
    • D Dave B

      Im dipping my toe into the murky waters of i/o completion ports.:confused: My app presently use threads to handle client connections , on for each connection. Naturally i now want to use i/o completion ports. Internally i do a lot of database access using odbc. Is there any way to link a SQLExec statement to a completion port ? Theres lots of examples of using sockets but nothing about databases. Doing an async read still involves polling to test the status of the executing statement, which will still mean using multiple threads. I cant believe theres not support for this but ,as ever, the MS docs are very light on the subject. Dave

      N Offline
      N Offline
      NormDroid
      wrote on last edited by
      #2

      Dave-B wrote: Internally i do a lot of database access using odbc. Is there any way to link a SQLExec statement to a completion port ? Theres lots of examples of using sockets but nothing about databases. Doing an async read still involves polling to test the status of the executing statement, which will still mean using multiple threads. Simple multithreading suits your application which uses SQLExec, IOCP is for overlapped reads/writes with SQL does not support.

      D 1 Reply Last reply
      0
      • N NormDroid

        Dave-B wrote: Internally i do a lot of database access using odbc. Is there any way to link a SQLExec statement to a completion port ? Theres lots of examples of using sockets but nothing about databases. Doing an async read still involves polling to test the status of the executing statement, which will still mean using multiple threads. Simple multithreading suits your application which uses SQLExec, IOCP is for overlapped reads/writes with SQL does not support.

        D Offline
        D Offline
        Dave B
        wrote on last edited by
        #3

        Norm Almond wrote: Simple multithreading suits your application which uses SQLExec, IOCP is for overlapped reads/writes with SQL does not support. As you state that SQL does not support overlapped read/writes, presumabley this means that IIS etc, are not truly scallable if the script uses database access X| . Thats a real bummer in the real world, though as i will have to have multi threads 'hanging around' for the database to return results. BTW thanks for your IOCP code. Dave

        A 1 Reply Last reply
        0
        • D Dave B

          Norm Almond wrote: Simple multithreading suits your application which uses SQLExec, IOCP is for overlapped reads/writes with SQL does not support. As you state that SQL does not support overlapped read/writes, presumabley this means that IIS etc, are not truly scallable if the script uses database access X| . Thats a real bummer in the real world, though as i will have to have multi threads 'hanging around' for the database to return results. BTW thanks for your IOCP code. Dave

          A Offline
          A Offline
          Anders Molin
          wrote on last edited by
          #4

          With IOCP you have some worker-threads, normally I go for 2 - 4 four for each CPU in the machine. If everything is running fast and not waiting for anything, your completion port only uses a single thread for each CPU, but if one of those threads is "suspended" waiting for disk I/O, a database or something else, and a new socket connection is opened, the completion port uses a new thread to handle that connection. Basically IO Completion Ports is a mix between a threadpool and async. I/O ;) - Anders Money talks, but all mine ever says is "Goodbye!"

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups