MirrorNetworking / Telepathy

Simple, message based, MMO Scale TCP networking in C#. And no magic.
MIT License
1.17k stars 136 forks source link

Data are far larger in V2 #100

Open J4z3 opened 3 years ago

J4z3 commented 3 years ago

Hello,

I've upgraded to V2 (2021 branch) to test it. It seems messages of "max message size" length are always sent, instead of only what is necessary.

Edit : this is only the case on reception side, i.e. messages of appropriate size are sent through the network, but OnData returns a message a max message size at the reception.

BR, Jaze

J4z3 commented 3 years ago

Ok, I now understand what happens (now in master = V1.6). This is due to Pool allocating byte[max_message_size] arrays. This is not too bad for a few messages due to the reuse system of the Pool class, however if a burst of messages happens, a lot of bytes are allocated and stay in the pool indefinitely for nothing.

michaelsakharov commented 3 years ago

This is definitely a problem in our and many other use cases. We run a server with 250+ players at peak hours with Tons of packets actively being sent, Highest packet count we have seen at once time was about 2000 packets! with the max packet being in the MB's since the server sends Map data and everything to the client this, in theory, could allocate 20+ GB of data then just leave it in memory?

We're currently using a very old version of Telepathy back from early 2020, we're gonna upgrade anyway and for the time being remove the Pool.