quote:
Original post by WebsiteWill
ThreadA: This thread is passed a function that does nothing but continuously reads the socket for an incoming packet. When a packet arrives then this thread/function reads in the packet and stores it onto a serverside data structure.
ThreadB: This thread pops a packet from the top of my serverside packet holder and processes it. By processing it I mean that it will first determine what kind of packet it is and then send that packet on the the actual thread that handles that kind of packet.
ThreadC: This thread executes a function that simply waits for a packet to be sent. When received, the thread will send the packet through the socket to the other side. It does nothing more than wait for a packet and then send it when it gets one.
ThreadsD-XXX: These will handle packet types. Not individual packet types but more like one thread to handle all chat packets. One thread to handle all movement_request packets. One thread to handle all inventory_specific packets.
This gets broken down however far I feel necessary but probably not very deep.
In one thread you recv(), lock queue, enqueue request, unlock queue. In another thread you lock queue, pop data off the queue, unlock queue, check the type, then lock another queue, queue data, unlock the second queue, and let it sit until sometime later for processing in yet another thread? Keep in mind that there will be context switches, and periods of time when your threads are waiting for their time slice to run. So this doesn''t necessarily happen in an immediate manner, even with multiple CPUs. I think this is overcomplicated to the extent that it will introduce more overhead than anything else.
ThreadsD-XXX: If you insist on using seperate threads for handling requests, I''d suggest just using a pool of generic worker threads rather than having a specific thread for each request type. That way all of the threads in the pool can spread the load a little better. example: imagine sitting in town where there is no combat, only tons of chat and tons of position updates. The thread handling combat requests is just sitting there while the chat thread appears to be lagging, and the location updates are making the client ''pop'' all over.
quote:
1) I am planning for quad processor machines minimum for the world servers so 4 threads minimum to utilize all processors.
Reality check. That is cost prohibitive to even companies like SOE and Blizzard. They use a larger number of budget Servers (EQ zone servers use single 500MHz systems IIRC). You might want ONE high-end server for your production database server, but you will not get funding for quad processors across the whole backend.
quote:Please don''t take this as a flame, it''s just more of what you asked for... Good luck. And if you are a self-funding developer that just inherited a billion dollars or something crazy, then disregard my comments about quad systems.
Please keep poking holes...