Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple NIO reactors, or just one?
    primarykey
    data
    text
    <p>I've currently been reading up on Java NIO and have made some implementations of it myself in the past. However, I've never really though about the performance of a server -- which seems really silly, and it is. I've heard people say that a single-threaded reactor is just fine, but I really want to take advantage of the cores that I have. </p> <p>Since the implementation I'd be making of it is a game, there's some game logic threads as well, so it can't take up a lot of threads -- if anything, it would probably be just two.</p> <p>Here's the plot that I've come up with:</p> <ul> <li>High-priority reactor <ol> <li>Accepts connections</li> <li>Handles the game's log-in process (client sends packet, server processes, server sends response packet, not a ton of data here)</li> <li>Distributes resource file data on demand (the game is built so the server sends data that the client stores in a cache that contains almost all the resources of the game. Most of this is done when they are loading the game, but a lot still happens in the background as the play)</li> </ol></li> <li>Standard reactor <ol> <li>Reads and responds to in-game packets; these are often small, but there are a lot of them, seeing as just about everything a player does is distributed as a packet, and I want to scale it well to handle well around ~200 players)</li> </ol></li> </ul> <p>Goals:</p> <ul> <li>Scale well for about 200-300 players</li> <li>Respond to game packets quickly</li> <li>Distribute the aforementioned file data quickly</li> <li>Accept connections quickly</li> </ul> <p>Also, if you are familiar with it, the game is RuneScape. My goal is emulation of RuneScape's official server software so mine can be used with one of their clients. It's a popular practice -- see <a href="http://www.runelocus.com" rel="nofollow">www.runelocus.com</a>, <a href="http://www.rune-server.org" rel="nofollow">www.rune-server.org</a>, i.e.</p> <p>My question is: do you think this would be a good implementation? Is just having one reactor a better idea? Or should I be using more? I would guess the data received and sent would be roughly the same, maybe a little more on the high-priority reactor (which is why it's high-priority.) </p> <p>Also, when I define it as high-priority, I'm not actually literally prioritising it over the standard reactor. It's just handling tasks that are considered more important than game packets. </p> <p>Any feedback is greatly appreciated :) If there's any clarification/explanation needed, lemme know!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload