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. Why use Multi-thread Servers?

Why use Multi-thread Servers?

Scheduled Pinned Locked Moved C / C++ / MFC
sysadminperformancequestionlearning
5 Posts 4 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.
  • A Offline
    A Offline
    Aidman
    wrote on last edited by
    #1

    Hi, all :) I am planning on an http web server, and I have read some of the I/O completion and multithread server articles, but I really don’t understand why anyone would develop a multithread server? Would it just make it more difficult and slow, because of all the critical sections that have to be thread-safe? Why use worker threads that loops until a service is requested. Can’t you just use completion callback and windows message-based notification of network events to serve connected users? What’s the point of using multiple threads in a server? My server is going to run on older windows versions (95/98/ME) so I have to handle the worker threads (if I should use them) and connection sockets by my self, and of course the server has to support at least 500 user connections simultaneously. Anyway, I really don’t see any performance advantage by using multiple threads, so please tell me what I am missing because it seems like everyone is using it. :( Thanks in advance Aidman » over and out

    A T A 3 Replies Last reply
    0
    • A Aidman

      Hi, all :) I am planning on an http web server, and I have read some of the I/O completion and multithread server articles, but I really don’t understand why anyone would develop a multithread server? Would it just make it more difficult and slow, because of all the critical sections that have to be thread-safe? Why use worker threads that loops until a service is requested. Can’t you just use completion callback and windows message-based notification of network events to serve connected users? What’s the point of using multiple threads in a server? My server is going to run on older windows versions (95/98/ME) so I have to handle the worker threads (if I should use them) and connection sockets by my self, and of course the server has to support at least 500 user connections simultaneously. Anyway, I really don’t see any performance advantage by using multiple threads, so please tell me what I am missing because it seems like everyone is using it. :( Thanks in advance Aidman » over and out

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

      Aidman wrote: windows message-based notification of network events to serve connected users? What’s the point of using multiple threads in a server? This is slooooow, and needs a Window which most servers dont have ;) Aidman wrote: My server is going to run on older windows versions (95/98/ME) so I have to handle the worker threads (if I should use them) and connection sockets by my self, and of course the server has to support at least 500 user connections simultaneously. 500 users at the same time on Win9x, interesting ;) Aidman wrote: Anyway, I really don’t see any performance advantage by using multiple threads, so please tell me what I am missing because it seems like everyone is using it. Normally I use asynchronous socket, or if on NT based systems, IO Completion Ports. A limited number of threads is a good thing, it makes the application scale on multi-CPU computers, a single threaded server only uses a single CPU. And also, when a thread is "suspended" when waiting for IO like disk or network activity, it's good to have extra threads to keep the processor(s) working (if there is work to do, of course) - Anders Money talks, but all mine ever says is "Goodbye!"

      1 Reply Last reply
      0
      • A Aidman

        Hi, all :) I am planning on an http web server, and I have read some of the I/O completion and multithread server articles, but I really don’t understand why anyone would develop a multithread server? Would it just make it more difficult and slow, because of all the critical sections that have to be thread-safe? Why use worker threads that loops until a service is requested. Can’t you just use completion callback and windows message-based notification of network events to serve connected users? What’s the point of using multiple threads in a server? My server is going to run on older windows versions (95/98/ME) so I have to handle the worker threads (if I should use them) and connection sockets by my self, and of course the server has to support at least 500 user connections simultaneously. Anyway, I really don’t see any performance advantage by using multiple threads, so please tell me what I am missing because it seems like everyone is using it. :( Thanks in advance Aidman » over and out

        T Offline
        T Offline
        Tim Smith
        wrote on last edited by
        #3

        Multiple threads buy you nothing as long as you don't have an extra CPU available. Oh and if you are never waiting on resources. Well, such as reading a file. Then multiple threads buy you everything. Tim Smith I'm going to patent thought. I have yet to see any prior art.

        1 Reply Last reply
        0
        • A Aidman

          Hi, all :) I am planning on an http web server, and I have read some of the I/O completion and multithread server articles, but I really don’t understand why anyone would develop a multithread server? Would it just make it more difficult and slow, because of all the critical sections that have to be thread-safe? Why use worker threads that loops until a service is requested. Can’t you just use completion callback and windows message-based notification of network events to serve connected users? What’s the point of using multiple threads in a server? My server is going to run on older windows versions (95/98/ME) so I have to handle the worker threads (if I should use them) and connection sockets by my self, and of course the server has to support at least 500 user connections simultaneously. Anyway, I really don’t see any performance advantage by using multiple threads, so please tell me what I am missing because it seems like everyone is using it. :( Thanks in advance Aidman » over and out

          A Offline
          A Offline
          Aidman
          wrote on last edited by
          #4

          Thanks for your replys, but I am still a bit confused :confused: Are windows message-based notification of network events really slow? Can't they serve connected users, like reading from disk or sending data? If I should have say up to 100 users connected to my server simultaneously, how is the best way to serve them? worker threads, windows message-based notification or somthing else? And also, is it better to let threads loop until data is recieved or to use windows message-based notification? Aidman » over and out We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.

          I 1 Reply Last reply
          0
          • A Aidman

            Thanks for your replys, but I am still a bit confused :confused: Are windows message-based notification of network events really slow? Can't they serve connected users, like reading from disk or sending data? If I should have say up to 100 users connected to my server simultaneously, how is the best way to serve them? worker threads, windows message-based notification or somthing else? And also, is it better to let threads loop until data is recieved or to use windows message-based notification? Aidman » over and out We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.

            I Offline
            I Offline
            Ilushka
            wrote on last edited by
            #5

            forget window-message notification for a number of users up 100. It`s going to kill you machine ;) Sincerely yours, Ilya Kalujny.

            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