Noobhub - Free Opensource Multiplayer And Network Messaging For Coronasdk

Youre mistaken by a 1000

(2*1024*1024*1024) / (8*1024) = 262144

Given the fact thet some multicore nodejs servers can handle up to million concurrent connections, that seems fair.

In real life, you will sooner face the fact that latency has grown too much (i.e. nodejs will spend a lot of CPU time just to send mesages to channels) than the fact that youre out of RAM for storing connections.

Oh, and for the second question. 

The fine-tuned test configuration  which really handled 1 million of concurrent connections was: Core i7-2600 Quad, 16Gb RAM

Sorry about the mistake. I was wondering something must be wrong!

I am planning to send out a message every 30 milli-second for a client (to sync client inputs), do you think it’s something totally reasonable? Anything I should be wary of?

@joe528, I’m guessing you are building a realtime multiplayer, with 33 HZ ticks.

TCP is not the best option for this, I’d recommend UDP.

Imagine the slight network fault. TCP will give you a huge lag, since messages are stacked in TCP/IP stream buffer, and they will wait until the protocol will resend broken packets, and only then will give out all the stacked messages in stream.

For UDP, you just skip broken or undelivered packets (which is one packet per one tick), and go on receiving ticks.

With realtime multiplayer based on ticks this is important.

So my suggestion is you test Noobhub and see if it will work fine for this.

Once you will start experiencing huge lags due to network faults (if any), its possible to rewrite Noobhub to utilize UDP.

Its not hard, and I would help with it (Im itchy to do this for a long time).

@overtorment

thanks for the comment. I will try it out first with TCP and let you know how it goes. Since my client will simply wait if a remote packet does not come for the current execution turn, so I am not sure how much impact would it be when some networking problem happens as you described. Maybe just halting a bit and catch up without problem? I will give it a try.

I have no experience in node.js though, your help to make it UDP compatible is very much needed (to stop the itch too :))

by the way, the site

http://www.develephant.net/

seems not running since 24 hours ago… it’s still down and you might want to take a look…

Hi,

Seems to be working now.  Not sure what the issue was.

Best.

@overtorment

I have tested sending a packet out every 30ms. There are two players sending to each other. I have put them there for an hour, and I can still play it without any problem after 1 hour.

Questions:

(1) As you said “Imagine the slight network fault. TCP will give you a huge lag”… how to test this situation? What else can I test further except putting it there for an hour?

(2) This is only for one game, two connections. I am wondering how to estimate the server capacity to handle FPS-kind of games (sending a message out on each frame)? Earlier when we discuss possible number of concurrent connections a server can handle, we just divide the total memory by 8k to get a rough number. But the scenario is not sending message out as crazy as this, right? If a client send out a message every 30ms, is there any way to estimate how many concurrent connections a server can handle before it goes to live?

(3) I think I should also give UDP a try since the game is totally fine for packet loss & unordered packets. And changing to UDP should give the server lighter processing load? 

I saw some code in the server side (node.js) when a socket is destroyed

if ( Object.keys(sockets[socket.channel]).length === 0 ) { delete sockets[socket.channel]; \_log('empty channel wasted'); }

I think the code is to clean up when the channel has no one subscribes. However, in my testing, I new saw this log “empty channel wasted” in the server log. 

I can see the log “xxxx has been disconnected from channel yyyyyyy”, and there is no one in the channel, I assume I should see “empty channel wasted” follows but I don’t see any at all.

Why is that? Any bad effects?

Hello guys,

Im happy to announce that latest vershion was recently pushed to Github. Mostry memory leak fixes.

One of Noobhub users reported that Noobhub happily serves 1.1k CCU (concurrent users) utilizing only 6% CPU on only one processor core, and consuming not more than 600 Mb RAM in peak. About  95k multiplayer games  runs through this instance daily.

And not a single millisecond of performance degradation (latency) on 1k CCU!

@joe528, what you see is latest improvenets to our nodejs code. This is a memory leak fix to be specific. We pushed this to Github only a couple of days ago, so you might be running older version in production.

@overtorment

Sending out a packet every 30ms or 100ms is working in Wifi but it’s not working in 3G network.

I am wondering if changing to UDP can improve things or I have to give up the idea.

(1)  this should be a very rare situation, when you occasionally get a time lag of 100-200 ms instead of 30 ms. 

(2) the only way is to increase gradually CCU (concurent connections) which send data, and measure the degradation of latency. I can assure you that 2k CCU wont give any latency degradation (battle-tested on production recently by one folk who uses Noobhub)

(3) not sure if lighter processing load will be even noticeable, sincse TCP/IP is also packets in the core

As for 3g, I would say the bigger issue is increased overal latency, for both protocols, so UDP is not a silver bullet. This is where latency-compensation and prediction algorythms come to play, and game-feel would totally depend on them. 

And I didnt get it, hows its not working?

When I say “it’s not working in 3G network”, I mean it seems the packets are received with a lot of latency, probably over 3 seconds and “unstable”.

The character in the game is either moving slowly or gets stuck for many seconds and then move a few frames.

@overtorment

Thanks for the reminder. Exactly, I was looking at Github source while my server was running with an older version.

It is great to know the performance. Only 6% for 1.1k CCU is very impressive.

I saw some code in the server side (node.js) when a socket is destroyed

if ( Object.keys(sockets[socket.channel]).length === 0 ) { delete sockets[socket.channel]; \_log('empty channel wasted'); }

I think the code is to clean up when the channel has no one subscribes. However, in my testing, I new saw this log “empty channel wasted” in the server log. 

I can see the log “xxxx has been disconnected from channel yyyyyyy”, and there is no one in the channel, I assume I should see “empty channel wasted” follows but I don’t see any at all.

Why is that? Any bad effects?

Hello guys,

Im happy to announce that latest vershion was recently pushed to Github. Mostry memory leak fixes.

One of Noobhub users reported that Noobhub happily serves 1.1k CCU (concurrent users) utilizing only 6% CPU on only one processor core, and consuming not more than 600 Mb RAM in peak. About  95k multiplayer games  runs through this instance daily.

And not a single millisecond of performance degradation (latency) on 1k CCU!

@joe528, what you see is latest improvenets to our nodejs code. This is a memory leak fix to be specific. We pushed this to Github only a couple of days ago, so you might be running older version in production.

@overtorment

Thanks for the reminder. Exactly, I was looking at Github source while my server was running with an older version.

It is great to know the performance. Only 6% for 1.1k CCU is very impressive.

Up!

Just pushed some fixes :slight_smile:

Thanks OverTorment

I just set this up in seconds and can getting ping/pong’s and recoveries after I restart the node service. 

I have played a bit more and have added debug info my server and am building a simple tester UI.

Is it ok to fork so I can make a full featured tester corona app and make the node server save to mysql so reconnecting people can view the history while they are away and save chats?

You are welcome!

You’re also free to do any modifications, but saving history to database won’t be accepted to main repository; but you can always commit  it in your forked repo.

The reason for this is that Noobhub is only a Pub/Sub server, not the storage for queues or smth.

Some users of Noobhub have hundreds of messages per second, and if Noobhub would store those messages it would add a headache to keep database perform well.