Thread: Choosing the Best Networking Solution for a Server Project

Page 1 of 9 123 ... LastLast
Results 1 to 10 of 85
  1. #1 Choosing the Best Networking Solution for a Server Project 
    brb ridin da storm

    blakeman8192's Avatar
    Join Date
    Dec 2012
    Age
    31
    Posts
    2,012
    Thanks given
    818
    Thanks received
    1,361
    Rep Power
    329
    So this is basically a discussion about the best networking system to use in a RuneScape server project.
    For simplicity sake, I ask that this discussion is limited to discussing Java implementations of networking only.

    The Options
    As far as I can tell, here are the most popular options:


    Let's get a good discussion going, weighing the pros and cons of all of these options - and hopefully we'll answer a lot of our own questions, clear any misconceptions, and learn a lot along the way. This thread is pointless and I look like a dumb optimist if nobody else hops in and joins the discussion, but I have faith that you guys will be a part of this. I'm asking everyone to not troll this topic, and instead contribute to a good discussion that'll teach a lot of people a lot of things.

    Java IO
    The very first communication system that Java has. It only supports blocking operations, which means that in order to support multiple clients simultaneously, concurrency needs to be used. This is what Winterlove uses, the "thread per client" approach that doesn't work out too well for performance. Many people choose to use Java IO for simplicity, even the RuneScape client uses Java IO. I believe that Java IO is only a reasonable approach when networking performance is not important in an application.

    Pros
    • Simple, for the most part.
    • Many guides/examples online, it's old and has been used a lot.

    Cons
    • Not scalable, needs concurrency to support multiple clients.
    • Restricted to using byte arrays which adds complexity to the packet system.


    Java NIO
    My personal favorite. Implemented with the reactor design pattern, it is by far the fastest networking system you can implement with Java, as long as you implement it properly. Faster than all of the other options, the only problems it has is the complexity of its' backing concepts and infinite variability with possible implementations. It can be very difficult to figure out when you first learn it, as you must first learn the underlying design of the reactor design pattern. Java NIO can also be very difficult to debug, due to its' inverted multiplexing flow of execution. And when it's implemented in a concurrent environment (for performance reasons), the complexity of the system increases a huge amount.

    Pros
    • Efficiency, stability, and speed. It's the most high-performance networking solution in the Java world when implemented properly.
    • ByteBuffers - a much better alternative to byte arrays. They're easier to use, and have support to read/write directly to/from memory natively in a seamless manner.

    Cons
    • Complicated, it's often viewed as some arcane art that most Java programmers never bother to learn.
    • It's inverted flow of execution makes it hard to debug problems that arise.
    • Has had a history of bugs in the Java API.
    • Gets ridiculously complicated when implemented in a concurrent environment.


    Mina, Netty, and XSocket
    I'll leave these topics for you guys. Go ahead and voice your opinions of the networking systems, this isn't a tutorial thread but is instead a discussion thread. Rune-Server today rarely has good discussions, and instead is filled up with flaming shitposts and ideas to monetize RuneScape Private Servers. RSPS is about technology, concepts, and a playground in which to test new programming ideas in a familiar game that I love. So what do you think of Mina, of Netty, and of XSocket?

    We haven't had a good discussion like this in a long time, so let's do it motherfuckers.
    rest in peace Qemist, Izzy, Colton, TeChNo PuNk, Impulser, & bootnecklad
    Reply With Quote  
     


  2. #2  
    Choosing the Best Networking Solution for a Server Project



    Scu11's Avatar
    Join Date
    Aug 2007
    Age
    30
    Posts
    16,307
    Thanks given
    7,215
    Thanks received
    12,308
    Rep Power
    5000
    This is sure to spark discussion, I know the topic has been going on for a long while. Isn't netty based off of NIO or something, I remember someone telling me it's a more user-friendly version of it.

    Attached image
    Reply With Quote  
     

  3. #3  
    brb ridin da storm

    blakeman8192's Avatar
    Join Date
    Dec 2012
    Age
    31
    Posts
    2,012
    Thanks given
    818
    Thanks received
    1,361
    Rep Power
    329
    Quote Originally Posted by Scu11 View Post
    This is sure to spark discussion, I know the topic has been going on for a long while. Isn't netty based off of NIO or something, I remember someone telling me it's a more user-friendly version of it.
    It's more user-friendly at the cost of the overhead associated with abstractions and object orientation, yeah.
    rest in peace Qemist, Izzy, Colton, TeChNo PuNk, Impulser, & bootnecklad
    Reply With Quote  
     

  4. #4  
    Hi.

    'Mystic Flow's Avatar
    Join Date
    Nov 2007
    Posts
    7,146
    Thanks given
    256
    Thanks received
    1,252
    Rep Power
    3714
    I like both Netty and MINA, but they can both be costly since it uses a good amount of OOP, but I don't think it's well suited for RSPS. Think about it, update server consumes bandwith and requests over 10k files which means a shitload of operations per request, but I don't think it affects anything much since event's are just discarded after usage, but eh.

    Edit:

    I also hate the fact that you can't edit the networking library yourself to your preferences unless you add the src to your server itself.



    Reply With Quote  
     

  5. #5  
    Registered Member thiefmn6092's Avatar
    Join Date
    Dec 2006
    Age
    24
    Posts
    2
    Thanks given
    26
    Thanks received
    389
    Rep Power
    0
    i think this post is useless since it makes obvious comparisons
    https://twitter.com/********s1

    If you are a starter and want to learn rsps coding, i think that the server that fits most of your requests is deathlypvpz.
    I know some stone heads will flame and say its shit, i completely agree buy deathlypvpz is the best thing to start with.
    And you must do some Java courses in codecademy to improve yourself.
    Reply With Quote  
     

  6. #6  
    Programmer, Contributor, RM and Veteran




    Join Date
    Mar 2007
    Posts
    5,147
    Thanks given
    2,656
    Thanks received
    3,731
    Rep Power
    5000
    Quote Originally Posted by Scu11 View Post
    This is sure to spark discussion, I know the topic has been going on for a long while. Isn't netty based off of NIO or something, I remember someone telling me it's a more user-friendly version of it.
    Netty can actually be used with NIO or the old-style blocking IO:

    org.jboss.netty.channel.socket.nio (The Netty Project API Reference (3.2.4.Final))

    org.jboss.netty.channel.socket.oio (The Netty Project API Reference (3.2.4.Final))

    Netty is my favourite out of those three APIs. MINA is alright but using the API feels a bit more cumbersome than with Netty. xSocket is really something I'd use to hack up a quick demonstration and I wouldn't use it for a large application.
    .
    Reply With Quote  
     

  7. Thankful user:


  8. #7  
    Renown Programmer

    Nikki's Avatar
    Join Date
    Aug 2008
    Posts
    3,992
    Thanks given
    553
    Thanks received
    1,078
    Rep Power
    5000
    Mina isn't bad either, testing my simple webserver earlier took 30,000 requests in 20-30 seconds (150% cpu on 4x 2.2ghz cores, didn't freeze or even cause a delay), but I've never really tried just plain java NIO, as you stated, I never got into looking into it.

    Honestly, any implementation works for a simple server, it's up to the user, but if you wish to take less time off networking and put more time into the server itself, mina or netty would be a good place to start..

    Mina also includes some useful utilities, such as throughput and other functions in it's core class.

    Overall, there's pros and cons of everything, you just have to find one that meets most if not all your requirements.
    Please don't add/pm me asking for RSPS help!

    Links:
    - Pastebin
    - Sleeksnap

    Reply With Quote  
     

  9. #8  
    I dunno, its fine I guess

    Join Date
    Feb 2007
    Posts
    147
    Thanks given
    12
    Thanks received
    33
    Rep Power
    265
    I've used xSocket in the past, but the API can be pretty clunky at times. The only exception to this, I feel, is xLightweb written by the same person which is really really nice for dealing with HTTP. I prefer it over the Apache equivalent.

    Netty is supposed to be the successor to MINA and I learned Netty first so I have no plans on messing with MINA. I've heard mixed things about it.

    One thing I like about Netty is the ReplayingDecoder which makes writing protocol shit trivial. With xSocket they don't really have anything like that, so you have to keep checking whether there are bytes to read.
    Reply With Quote  
     

  10. Thankful user:


  11. #9  
    Registered Member
    Deadly Uzi's Avatar
    Join Date
    Jul 2008
    Posts
    994
    Thanks given
    177
    Thanks received
    87
    Rep Power
    362
    Raw NIO, of course.

    You learn a lot of stuff along the way (you know what I mean Blake), and you can fit it to your needs, and it can provide some amazing performance.

    I think being able to make your own stuff without the help of external libraries is important because I would hate to be dependent on a library to do the networking for me (like I'm sure quite a few people are).

    But I guess I'm a bit biased because ever since I've been talking to Blake, he's always been helping me up with that kind of stuff, so really that is the only thing I am accustomed with.
    Attempting to develop a multi-revision library. See it on GitHub.
    Reply With Quote  
     

  12. #10  
    Registered Member
    Join Date
    Jan 2009
    Posts
    88
    Thanks given
    4
    Thanks received
    4
    Rep Power
    12
    I cannot comment on the coding side of it, only the effect that it had on my server from changing from Winterlove IO to mina. We made the change due to IO taking 2-3 minutes to log everyone in, after changing to mina we could log everyone in after 5 seconds, this is with about 250 players. However the main downside that we experienced was that CPU usage increased 2 fold. From what I have heard, I think it would of been best if we had used netty but it is now not worthwhile changing. Therefore I believe that IO is fine for smaller servers, but once a server gets big it requires more advanced networking to handle the strain.
    Reply With Quote  
     

Page 1 of 9 123 ... LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Client/Server Networking
    By Vegito in forum Help
    Replies: 3
    Last Post: 12-19-2010, 02:22 PM
  2. Replies: 0
    Last Post: 11-16-2010, 02:08 PM
  3. Need help choosing VPS !
    By Henkkaah in forum Hosting
    Replies: 6
    Last Post: 08-07-2010, 05:32 AM
  4. Replies: 15
    Last Post: 04-27-2010, 07:35 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •