lnobad / lidgren-network-gen3

Automatically exported from code.google.com/p/lidgren-network-gen3
0 stars 0 forks source link

Increasing channels exponentially impacts server CPU loading #52

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set channels to 99 in NetConstants.cs
2. Run on 500 CCU client
3. Server CPU loading approx 25%

What is the expected output? What do you see instead?

Expect output should be a small server cpu loading < 0.1%

What version of the product are you using? On what operating system?

Please provide any additional information below.

Set the channels to 10
The cpu loading < 0.1% which is working fine.

Original issue reported on code.google.com by mark.js...@googlemail.com on 3 Nov 2010 at 11:55

GoogleCodeExporter commented 9 years ago
ANTS Performance Profiler

1000 CCU Test Exploads CPU Loading to 80%

400 Client CCU, NetConnection.HeartBeat calls = 9330,  CPU Loading = 0.02%
800 Client CCU, NetConnection.HeartBeat calls = 10 Million, CPU Loading = 25%
1000 Client CCU, NetConnection.HeartBeat calls = 55 Million, CPU Loading = 80%

The issue is that NetConnection.HeartBeat is getting called exponentially as 
the 
CCU Client increases.  

Original comment by mark.js...@googlemail.com on 3 Nov 2010 at 12:19

GoogleCodeExporter commented 9 years ago
Heartbeat is called once every millisecond except for when a packet arrives; 
then the loop will call it again pretty much immediately. That's probably what 
you're seeing... I'll look into adding a max cap on heartbeats/second...

Original comment by lidg...@gmail.com on 3 Nov 2010 at 12:32

GoogleCodeExporter commented 9 years ago
Try rev 146 - connection heartbeats are now capped to a certain number (250 - 
1250) depending on number of connections

Original comment by lidg...@gmail.com on 3 Nov 2010 at 1:01

GoogleCodeExporter commented 9 years ago
Ive just added a heart beat throttler myself to rv141 to test it and its 
working fantastically now.

I was able to run 10 channels, 1000 CCU, throttling heartbeats per 
NetConnection  20/sec, with a server load of 0.28%

I believe the server could now support a very large amount of CCU.

Original comment by mark.js...@googlemail.com on 3 Nov 2010 at 1:46

GoogleCodeExporter commented 9 years ago
Sounds good. Remember tho that 20 heartbeats/second is pretty low... 
introducing 50ms of latency to all sends, all acks etc.

Original comment by lidg...@gmail.com on 3 Nov 2010 at 2:01