Sign in to follow this  

GonzoNet - high level library for large scale robust networking

This topic is 1079 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Thought I'd stick my library here like muchaho. GonzoNet is a library designed for large scale distributed networking (think MMO.)
It currently only supports TCP, UDP might be added in the future (UDP is uncommon for MMOs and so wasn't considered important when designing)
Unlike a lot of other libraries out there, GonzoNet does not impose a protocol on an application, and so is more like a high level wrapper on top of .NETs asynchronous sockets.
The code hasn't been cross compiled, but it uses no special namespaces that you shouldn't be able to find in Mono.
It has been tested with up to 300 concurrent users in a real setting (Though no actual "gameplay" was involved, as the project it is used for hasn't progressed further than the character creation/selection/login stage.)
GonzoNet supports authentication and encryption using Diffie Hellman EC, which was actually suggested to me on these boards!

Edited by MatsK

Share this post


Link to post
Share on other sites
When I think of "large scale" socket wrappers, I'm usually aiming for more like 50,000 simultaneous (low-traffic) connections. If they're all heavily active, I should be able to do at least 10,000 before I start seeing networking take a prohibitive amount of CPU time.

Since this library is aimed at scalability, what design choices were made specifically to allow scaling? What are its performance characteristics in actual large scale scenarios?

Share this post


Link to post
Share on other sites
Well, since this library is so low level, scaling will be mostly on the application design level.
However, I've tried my best to guarantee 100% thread safety, so that an application (typically server) can be designed to be scalable without worrying about the low level architecture.

Share this post


Link to post
Share on other sites
As for performance characteristics, I've tested it for 300 simultaneous users (see OP.)
I guess I really should write a test case that can spawn 10,000 clients, bit haven't gotten round to it yet.

Share this post


Link to post
Share on other sites

However, I've tried my best to guarantee 100% thread safety, so that an application (typically server) can be designed to be scalable without worrying about the low level architecture.


I think ApockPIQ is trying to tell you, subtly (using the Socratic method :-), that you probably shouldn't "release a library" without actually having significant experience in how to write the kind of code that goes into that library.
Scalability for low-level networking on modern servers have to do with lockless worker queue implementations and asynchronous/event-based I/O, putting exactly one thread per CPU.
"Guarantee 100% thread safety" seems like you're using a fair bit of locks, which probably is not what someone who really was looking for a high-scalability networking library would be looking for.

Share this post


Link to post
Share on other sites
Lock-free queues are generally better where you can (safely) use them.

Perhaps I should ask the question another way:
- Why should I use your library instead of straight async sockets?
- Why should I use your library (or trust you) as opposed to some other library (and the author of that library.)
For example, for C#, the Lidgren library has been around quite a while, and has been hardened by being used for real in several existing games.

Note that I'm not questioning you -- I'm trying to help you formulate your market communications in a way that's clear!

Share this post


Link to post
Share on other sites

Lock-free queues are generally better where you can (safely) use them.

Perhaps I should ask the question another way:
- Why should I use your library instead of straight async sockets?
- Why should I use your library (or trust you) as opposed to some other library (and the author of that library.)
For example, for C#, the Lidgren library has been around quite a while, and has been hardened by being used for real in several existing games.

Note that I'm not questioning you -- I'm trying to help you formulate your market communications in a way that's clear!

 

1. Easy - because using straight async sockets means you're probably going to end up writing some kind of wrapper on your own anyway. I already did that! :)

2. GonzoNet has already been used in [url=https://github.com/Afr0/Project-Dollhouse/]Project Dollhouse[/url], which has 331,180 LOC (including GonzoNet) and been found to work quite nicely. However, I need to write more test cases to come up with more hard data!

PS: Thanks for guiding me onto lock free queues! :)

Share this post


Link to post
Share on other sites
designed for large scale distributed networking (think MMO.)

 

 

 

When you say things like this, you have to be able to answer the question: how many MMOs have you built with this networking library (or the primordial form of this library) and what are their traffic, architecture and concurrency statistics?

 

Anybody can say they've designed a thing for MMOs, but until you can show it's actually worked in an MMO of suitable scale, you're going to create nothing but skepticism with a marketing point like that.

Edited by Josh Petrie

Share this post


Link to post
Share on other sites

Also, you should include a license in the repository or the code is technically unusable (I see that you have license headers on some files, but not others; it would be clearer if you simply had a LICENSE.md file in the root, or something).

Edited by Josh Petrie

Share this post


Link to post
Share on other sites

Josh Petrie, thanks for pointing out the license issues. I updated the headers for the files that were missing it, and sent a couple mails to the people who wrote the code for the ones where I deliberately didn't put a license.

If they don't reply, can I put in License.md that these files are NOT covered by the license?

 

As for your MMO question, Project Dollhouse is an MMO - or rather a remake of one. The userbase is such that the I'll probably never get above 1000 simultaneous players, but I'm absolutely confident that GonzoNet could handle more. I'm going to write a test case to prove that.

Share this post


Link to post
Share on other sites
Keep in mind that at scale things rarely behave linearly. Just because you have headroom with 300 doesn't mean you can scale past 3000, just as an example. At scale things typically behave stepwise: you're fine until you hit the wall, at which point you are very much not fine anymore.

Share this post


Link to post
Share on other sites

So I rewrote GonzoNet and my servers to use BlockingCollection instead of ArrayList and ConcurrentDictionary instead of Dictionary.

However, I'm pretty sure I read on MSDN somewhere (I can't find the article right now) that I should be using BlockingCollection.GetConsumingEnumerable() when doing a foreach loop, because the standard foreach iterator will block threads.

So... how would I then readd items into the collection after I'm done consuming them?

Could I add them to a temp collection and replace the original one with the temp? Would that be safe?

Share this post


Link to post
Share on other sites

This topic is 1079 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this