My game server is written in .NET 3.5 (Unity3d) with Lidgren. I've been trying to write it in a way that allocates little to no garbage, but at this point it's inevitable. In my application one server can host multiple games, and games can host multiple zones. Each game runs in its own dedicated thread, and trying to pool/re-use objects between threads is probably going to cause a lot of headache and I'm not sure it's worth it. Up until now I've been re-using objects quite often, the lifetime of these objects can put them in generation 1 or 2 but they only live as long as the game (or zone) is open, and games (or zones) will be opening/closing often.
So my question is, should I keep trying to fight the garbage collector, or should I make an effort to keep objects short lived? My servers execute logic at 30 steps per second. Will it be a problem if my server is allocating megabytes worth of short-lived objects each step? I'm shooting for the best performance I can possibly get.
Another option I am considering is compiling my servers to be standalone so that I have access to a more modern .NET & garbage collector, but this will reduce my workflow substantially
↧