Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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 4272 times)
0 Members and 1 Guest are viewing this topic.
Offline georgek

Junior Newbie





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

hi,

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, http://www.java-gaming.org/topics/java-nio-unblocking-server-with-multiple-clients/20630/msg/167616/view.html#msg167616 , 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 java.io.File.  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 Duke





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

There is support for AIO sockets in Netty 4.0.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (38 views)
2014-10-17 03:59:02

Norakomi (29 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (28 views)
2014-10-15 16:18:58

TehJavaDev (56 views)
2014-10-14 00:39:48

TehJavaDev (55 views)
2014-10-14 00:35:47

TehJavaDev (46 views)
2014-10-14 00:32:37

BurntPizza (64 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (78 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org 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‑gaming.org
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!