|
Notably it's missing a release() call at the end of the channelRead() method in the server-side implementation (it isn't done automatically as they aren't using SimpleChannelInboundHandler), so it'll be needlessly allocating new inbound buffers and relying on the GC (rather than reference counting) to clean them up. Relying on the GC for Netty's pooled buffers works badly as it uses off-heap memory (if it can), so the GC isn't aware of the memory pressure and probably won't free them quickly enough.
(Interestingly they did remember the release() call in the client though.)
See my post below, I missed something.
Actually I've just realised it's fine, because it writes the input buffer back out to the channel, so there's no need to reduce its reference count (as ctx.write() will do it once the packet has been sent).
though fwiw, I still think the benchmark is also not particularly realistic - e.g. it is using TCP but doesn't actually implement framing properly. This is not something you can assume in a real-world environment, as TCP is a stream-oriented protocol and the OS can and will split a write() into several TCP packets, or split a read() up on the other end.
I still don't doubt CoralReactor is faster though - I presume the guy is re-using the same NIO buffer for all reads/writes to achieve that. If you really want performance you can do this, but it probably does mean your end user code will be more awkward to write on top of the library, so there are trade-offs involved.
Is there even anyone here that ever got to use the Coral Reactor library?
I didn't manage to get ahold of a trial version at first but I really wanted to try.
Because it didn't work the first time around I applied with an IT company email
to see if they would get back to me and still they never did...
Their target demographic is the financial industry (banks/trading/hedge funds etc). Doubt they'd respond to anyone unless they're willing to pay 6+ figures in licensing for it.
They write very nice software and a price tag to match.
I've also played around with https://github.com/OpenHFT/Chronicle-Network (similar use cases in high frequency trading etc) and from my experience was faster than Netty as well. Although the API is no where near as easy as Reactors or Nettys.
They also have a nice suite of libraries if you haven't already checked them out. They hide some features behind pay walls for pro licensing, but I haven't found myself needing anything their free open source version didn't already offer.
At the end of the day, in the context of the specific application of a RuneScape server emulator, the 80/20 rule rears its sobering head. It kinda doesn't matter how efficient the networking library you're using is and spending a non-trivial amount of time optimizing for that is time better spent on actually implementing something you're more familiar with. The real world overhead for something like this will be in the order of milliseconds per hour, if not less significant.
It's akin to replacing the piston rings in your '05 Civic every 5,000 miles to prevent any power loss from wear - aka, lots of work for next to zero reward. Your time, energy and effort are best placed elsewhere, like actually implementing the thing!
It's nice to use a well-tested networking library when they are available, but I couldn't find a good C# one so I just decided to use plain old APM System.Net.Sockets
A dotnetty example:
https://github.com/JayArrowz/NetScap.../GameServer.cs
I think MS have stopped working on dotnetty and its being carried on by the community in another repo. Will post when I get more info.
Edit:
More info - https://github.com/cuteant/SpanNetty
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |