Article 2955 of microsoft.public.win32.programmer.kernel: In article <344ACEFB.67ED@msi.net>, Louis Repasi writes: > Jamie Hanrahan wrote: > >> > You need a different design. >> >> Agreed, even so. >> > > First of all I would like to thank everyone that responded to my > question. > > Maybe a little bit more information on my project would help. I'm > writing an application that contains several different games to be > played on the Internet. The server must contain all the logic for the > games. This will prevent cheating. The server must remember the state of > each game in play. The games are simple and don't require much processor > time or data space. I'm writing the application as a Windows NT service. > It has no user interface (GUI). I'm looking at supporting 1,000 - 10,000 > connections at the same time on the server. The server is a Pentium II > 266, with 512 Megs of RAM and a 2Gig Ultra Fast Wide SCSI hard drive. > I'm looking at running 5 - 10 of these servers. > > Given this problem, should I use threads, fibers or something else? Can > I support so many connections? Threads are fine, but you don't need 'n' of them for 'n' clients. Instead you keep all the context info for each client in a (or findable via) a per-connection data structure, which you set up when the connection is established. Have a limited number of worker threads (if the games are that simple, say just a few more than you have CPUs) all waiting on an I/O completion port. When you get a packet from any of the links assoc'd with the port, one of the threads will be un-waited. It can use the tag value you pass via the port (a unique value per link, and it can be a pointer) to find the data structure for the connection in question, "do the next thing" on that connection, update the context, and go back to the wait. As for supporting that many clients, I don't know; it depends on how much work each needs. I would definitely go to a multiprocessor system though. A two-way 200 MHz machine will give you much more throughput than your single-CPU 266 Mhz. A four-CPU machine (you'll need NT Server for that) would be even better. --- Jamie Hanrahan, Kernel Mode Systems, San Diego CA Internet: jeh@cmkrnl.com (JH645) CompuServe: 74140,2055 drivers, internals, networks, applications, and training for VMS and Windows NT NT driver FAQ, links, and other information: http://www.cmkrnl.com/ If you post a reply in news, please don't e-mail it too.