Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (781)
Games in Android Showcase (233)
games submitted by our members
Games in WIP (857)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Netty vs. NIO2 vs ...? for mud  (Read 12452 times)
0 Members and 1 Guest are viewing this topic.
Offline georgek

Junior Newbie

« Posted 2013-01-29 03:22:24 »


I'm figuring out how to write a mud, and Netty sounded like a good library. However in reading about that I learned of NIO2 (new with Java 7). There are some articles out there about NIO2 but I'm wondering if anyone here has some thoughts or experience on using NIO2 vs. Netty (or similar single-threaded async libraries).

Of course NIO is an option but since I'm using Java 7 already I thought why not NIO2.

There was this thread here, , but it is from a few years ago so maybe there are some fresh perspectives.

Thanks for any help.
Offline sproingie

JGO Kernel

Medals: 202

« Reply #1 - Posted 2013-01-29 05:59:04 »

Netty is a layer on top of NIO.  NIO2 is just some extra stuff for filesystem operations, including something a whole lot more sane than  Netty's a fine choice for writing network servers, but if I were going to make a modern MUD, I'd probably just make it all web-based and do it all with ajax.  A jetty server out of the box could handle and retire more commands as individual http requests than any MUD ever dreamed of a decade ago using telnet.  Maybe I'd go with websockets, but probably not even that.
Offline Mads

JGO Ninja

Medals: 26
Projects: 3
Exp: 6 years

One for all!

« Reply #2 - Posted 2013-01-29 10:04:12 »

I think it might be overkill to use NIO for a MUD. How about normal blocking I/O? You can get decent performance out of those. NIO was designed for waaaaay more connections than I think you would ever need.

EDIT: This wasn't the question in the OP. My apolegies.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline georgek

Junior Newbie

« Reply #3 - Posted 2013-01-29 19:11:23 »

Thanks for the replies. I think I'm confused about some of the terms here. In my reading I  see a lot about asynchronous operations (like those supported by NIO2). I always equated this with the classic multiplexed single-threaded server design (like you see in a lot of old muds that use select() and so on).

However now it seems like async and single-threaded multi-plexed are two different things. Can anyone comment as to why an async design might or might not be better for a mud?
Offline sproingie

JGO Kernel

Medals: 202

« Reply #4 - Posted 2013-01-29 21:12:07 »

You can do asynchronous I/O with thread-per-connection and you can do fully blocking I/O with select.  It's just that 1-1 threads makes blocking easy, and blocking on select is only useful when nothing else is running, so those designs tend to find their level with the API style that is easiest to work with.  

Asynchronous just means you don't want for I/O to complete, but someone else is waiting for it to complete instead, whether its a background thread polling a set of fd's, or the OS's internal I/O scheduler taking care of it directly.  When some I/O is completed (e.g. a full line or packet or whatever is read or written), then that background routine notifies you through a callback.  It's stringing callbacks together like that that makes an API asynchronous, not necessarily the I/O primitives used under the surface.  Asynchronous just means you're not waiting for anyone to finish, but you'll let them call you back when the result's ready.

MUDs almost exclusively use classic select()/poll(), which is the basic design of NIO, yes.  With Netty, that select loop tends to run in its own thread, freeing you to write code that's purely based on callbacks, which again is the essence of an asynchronous API.
Offline VeaR

Junior Devvie

Medals: 3

« Reply #5 - Posted 2013-02-20 16:15:38 »

There is support for AIO sockets in Netty 4.0.
Pages: [1]
  ignore  |  Print  

hadezbladez (1176 views)
2018-11-16 13:46:03

hadezbladez (528 views)
2018-11-16 13:41:33

hadezbladez (1187 views)
2018-11-16 13:35:35

hadezbladez (273 views)
2018-11-16 13:32:03

EgonOlsen (2570 views)
2018-06-10 19:43:48

EgonOlsen (2789 views)
2018-06-10 19:43:44

EgonOlsen (1565 views)
2018-06-10 19:43:20

DesertCoockie (2269 views)
2018-05-13 18:23:11

nelsongames (2122 views)
2018-04-24 18:15:36

nelsongames (2816 views)
2018-04-24 18:14:32
Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!