Search Unity

Third Party Is there any problem on increasing the maximum allowed connections in Mirror?

Discussion in 'Multiplayer' started by gillemp, May 26, 2020.

Thread Status:
Not open for further replies.
  1. gillemp

    gillemp

    Joined:
    Nov 23, 2015
    Posts:
    81
    I'm developing a game where I do not care about how many clients are connected (it is just for fun and to learn about networking) so I wanted to set the maxConnections to the highest value possible.

    However, I do not know if it can affect the performance or the internal functionality in any way.

    The documentation says that changing the value "effects the memory usage of the network layer" but it does not say in which way.

    I get that having 1000 CCU will be stressful, but if I have the limit set to a 1000 and there are only 4-5 CCU will it be bad it any way (like reserving memory, doing unnecessary work, ...)?
     
  2. Vincenzo

    Vincenzo

    Joined:
    Feb 29, 2012
    Posts:
    146
    Mirror breaks bricks quickly getting 100 players will be hard already.
     
  3. gillemp

    gillemp

    Joined:
    Nov 23, 2015
    Posts:
    81
    Okey... but it does not answer my question....
     
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,067
    The number of actual connected players will affect the perfomance. A theoretical limit which you don't reach, should not have any negative effect.
     
  5. gillemp

    gillemp

    Joined:
    Nov 23, 2015
    Posts:
    81
    Thanks!
     
  6. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Mirror is a fork of Unet, and Unet used the max connections setting to basically pre-allocate all resources (memory) that it may ever need when the maximum number of connections are active. In my own testing Unet would allocate several gigabytes of memory as soon as the server comes up when configured for 1k connections.

    Mirror though uses an entirely different transport, not based on the original used by the Unet LLAPI, and can be configured to use one of several transports. I'd be a bit surprised if they followed the same memory pre-allocation behavior as original Unet.
     
    gillemp and tobiass like this.
  7. gillemp

    gillemp

    Joined:
    Nov 23, 2015
    Posts:
    81
    Should increase the number of max connections to really high values and check the change memory usage in runtime show if they disabled the memory preallocation?
     
  8. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    That would be my assumption. I first noticed the issue with Unet with just the "top" command where it says percentage of memory usage after I changed only the max connections value between builds.
     
  9. Oberheim

    Oberheim

    Joined:
    Jun 4, 2020
    Posts:
    24
    Hi !

    New here! Using Mirror.
    What happens if the maximum connection is reached in a single room ?
    I'm struggling understanding how the server reacts to it ?
    I would like the server to create new instances of the game everytime the max connection is reached.
    Trying to have 20 players in each room. As soon as player 21st tries to connect, a new instance is created (he would then be alone in this new instance)
    Any tips would be much appreciated!

    Thanks a lot <3
     
  10. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    NetworkServer.OnTransportConnected rejects any connection > max.
     
  11. Oberheim

    Oberheim

    Joined:
    Jun 4, 2020
    Posts:
    24
    Ok ! That's the first rock info for ma fondation :)
    How to tell him to create a new server instance on a new port when connection is > max ?

    Or maybe I am looking to the wrong direction ?
     
  12. MihailLuhov

    MihailLuhov

    Joined:
    Aug 10, 2020
    Posts:
    6
    Hello! As of March 2022, is the max number of connections still 100? I know the default value is that but if I set it higher and more players connect, is there going to be a very noticeable difference in the performance?
     
  13. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    The more players, the slower your server becomes.
    It depends on your game, i.e. simple 2D click & move game can handle way more than complex 3D physics / character controller game.

    We have a CCU test planned in the coming months.
     
  14. Punfish

    Punfish

    Joined:
    Dec 7, 2014
    Posts:
    401
    I know a developer that published on an up-to-date Mirror version and they said their servers were beginning to crash around 60 CCU. Their game had only a handful of NPCs and 1 object per player. The player object itself is only a few networked scripts and a NetworkTransform.
    With this in mind, I'd use caution when increasing your max players count.
     
    Last edited: Mar 30, 2022
  15. MCoburn

    MCoburn

    Joined:
    Feb 27, 2014
    Posts:
    71
    This question pops up a lot. A simple answer is "it depends". A more technical answer is that it depends on a lot of factors. Like vis stated above, it really depends on what your Mirror game is - a shooter game running in Mirror is heavier server-wise than a MMO or a simple networked co-op point and click adventure game.

    To get a proper answer on the maximum connections Mirror can handle, you must include factors such as:
    • How much data each object is synchronizing, is it small amounts or huge chunks?
    • How often is that data being transmitted, like every frame, every second frame, on a interval, when a value changes, etc?
    • Are things like voice, video and raw data being transmitted, etc?
    Amongst a lot of other questions that go deep into the networking rabbit hole.

    Mirror can achieve high player count for sure, as some of the games it powers have shown. It's just a very careful balancing act.

    The best advice I can say is forget about what number the "maximum connections" is in Mirror and aim to achieve your desired target - be it 200 players or more. See how the network stack performs. If Mirror royally craps the bed, then okay, that's a concern. Although with that said, you may surprise yourself.

    Keep in mind if it does crap itself at X player count, there is always room for optimization - you just need to get a rough working version of your networked game running, before you optimize.

    If you have advanced programming knowledge, you could even replace chunks of Mirror with your own code to make it better and reach higher player counts. This is what some released games have done, basically using their own in-house patched Mirror version.
     
    Last edited: Apr 1, 2022
    trombonaut likes this.
  16. Punfish

    Punfish

    Joined:
    Dec 7, 2014
    Posts:
    401
    Coburn, developer of Mirror, I agree users code can affect CCU but I don't agree that the user should have to modify Mirror core to improve CCU; that statement contradicts the question.

    My comment about Mirror servers crashing at 60 CCU were for a very casual, very lightweight game. In my expert and honest opinion, out of the box Mirror should be targeting smaller games. Mirror simply is not optimized for more CCU and/or network activity.
     
  17. JamesFrowenDev

    JamesFrowenDev

    Joined:
    Oct 10, 2015
    Posts:
    20
    Who are these Mirror users that have problems like crashes but then dont ask for help from Mirror developers about those crash? Sounds like you are making it up to start more drama.

    Mirror does have limits, But using the Unity profiler it can be easy to see where the problem is, and if it is with user's code or mirror code.

    I have run a Mirror server in production with 200 CCU with some minor optimizations (like Improved NetworkTransform)
     
  18. Punfish

    Punfish

    Joined:
    Dec 7, 2014
    Posts:
    401
    Hello James, another Mirror developer.
    I'm speaking of someone which recently left Mirror because their Mirror servers were regularly crashing around 40 CCU. I previously said 60 but after reading back through the conversation it was actually 40. The developer switched to my networking solution without any modifications and had since increased their CCU limit to 500, and they have not reported any problems yet. This would very much suggest it's a Mirror problem and what I've said about Mirror not scaling is reasonably true.

    I don't make up information. I'll be showcasing the mentioned developer's game soon enough.

    Also, it's my understanding they did ask for help but did not receive any (not my words).

    Let's try to stay civilized. I'm not attacking anyone, only helping others know what to expect.
     
    Last edited: Apr 1, 2022
  19. JamesFrowenDev

    JamesFrowenDev

    Joined:
    Oct 10, 2015
    Posts:
    20
    This is a thread talking about Mirror why does it matter who is a mirror developer or not? Also I dont work on mirror any more, and you know this, you are just trying to mislead people. :(

    You are here to say "Mirror BAD", and then advertise your solution.

    You have lied about so much stuff in the past, I would be really happy to see proof this time :)
     
  20. tuf_dev

    tuf_dev

    Joined:
    Jan 1, 2015
    Posts:
    8
    Hi!
    I used Mirror in my game and despite the sheer amount of issues caused by my own code, Mirror easily handled 60 CCU (that's the maximum amount I tested). Although I don't like Mirror (or your fork of it for that matter), "crashes at 40 CCU" is a complete nonsense claim with no actual facts behind it. I have also seen and played Mirror games with 100s of CCU.
    I'm also not buying the "asking for help and not receiving it" part, you see, I'm constantly on Mirror's Discord server and so far I have not seen a more helpful community, not just about questions related to Mirror or Unity, but in general. There is even some madman named "MrGadget" who spent 12 hours a day in #help channel answering same questions for years.

    Despite your claims to be "superior to Mirror", you fail to showcase a single game made using your library. You also keep posting benchmark results but present no actual benchmarks or cases.

    Mirror on the other hand, despite being bad for many reasons, is used by hundreds of games. Some of them have thousands of CCU (CCU in this sentence means users connected to the game, not a particular server instance).

    Now, I'm not a developer of Mirror, I'm just someone who likes hanging around in its Discord server. I'm not saying Mirror is perfect or is what it claims to be. All I'm saying is, you seem to have a ton of baseless claims with absolutely no supporting evidence and you shamelessly keep advertising your heavily modified version of Mirror whenever someone mentions Mirror. This is not something "civilized", it is the same thing as some kid making a game engine and advertising it in every single Unity support thread.
     
  21. Punfish

    Punfish

    Joined:
    Dec 7, 2014
    Posts:
    401
    TufanMeric, aka Tuf on the Mirror Discord. So this is you?



    I couldn't share the more vulgar ones.
     
  22. tuf_dev

    tuf_dev

    Joined:
    Jan 1, 2015
    Posts:
    8
    Ah yes, handpicking messages without providing context. Those pictures are no different than me quoting a single word in a 10000 word article.
    Sounds awfully familiar, perhaps you should consider a career in US politics?
     
    ManOfDrive likes this.
  23. tuf_dev

    tuf_dev

    Joined:
    Jan 1, 2015
    Posts:
    8
    Let me provide some context

    Speedrun a ban - was a running joke when punfish was a member of Mirror
    upload_2022-4-2_0-10-39.png

    N word copypasta
    https://twitter.com/tylerthecreator/status/285670822264307712?lang=en

    FishNet is a meme - well, yes? It is? even the name of it was born out of a joke cooper made.

    he must be banned - this is a meme you created by constantly creating alt accounts to spam Mirror server with your ads. seriously, even taking the emotes out of context? Pathetic.
    upload_2022-4-2_0-12-23.png

    All of the screenshots you posted were carefully handpicked from my message history in Mirror Discord's S***posting channel, #watercooler. That channel is 90% nonsense messages.

    Too bad you spent 30 minutes of your time picking these messages to avoid replying to a message stating facts.
     
  24. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    I believe OP’s Mirror related question has been answered.

    The rest seems better suited in the “what netcode to use” threads.

    Perhaps it’s time to retire this thread by a mod.
     
    luke-unity likes this.
  25. Punfish

    Punfish

    Joined:
    Dec 7, 2014
    Posts:
    401
    Agreed, and as I was trying to say before others derailed the thread, the advertised CCU claim is misleading.

    Anything can run hundreds of CCU if the hardware is powerful enough but for someone trying to stay under $100 it's unreasonable to believe that Mirror will hit "400 CCU worst case scenario" as described in your documentation, let alone 200 CCU.

    Numerous user experiences describe Mirror as scaling poorly, as well do simple tests. I think a more proper way of advertising your CCU would be to show the costs involved to achieve said hundreds of CCU.

    Far as comparing networking options, I only brought up mine as a comparison to add validity to the fact Mirror doesn't scale well compared to the plethora of options available today; after all, this thread is about scalability.
     
  26. JamesFrowenDev

    JamesFrowenDev

    Joined:
    Oct 10, 2015
    Posts:
    20
    Please stop trying to start drama.

    If you have benchmarks, Please make a public github repo so everyone can see it. otherwise please stop.
     
    tuf_dev likes this.
  27. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Any more issues between punfish and any other individuals of the mirror community will result in bans for both parties. I don't care who is right or wrong. Each account I've seen so far is incredibly childish from all parties and detrimental to other forum users, therefore no sides will be taken and both parties will be banned from posting next time I see it occur from this date.

    This thread has outlived it's value, along with any other thread similar. Go to discord for support and do not enter into each other's threads. This is non-negotiable.

    Use ignore feature, often if you have issues. This is beyond a joke.
     
    samhain323 likes this.
  28. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    And locked.
     
Thread Status:
Not open for further replies.