MTA Anti-Cheat Team Dutchman101 Posted June 24, 2014 MTA Anti-Cheat Team Share Posted June 24, 2014 Edit: This advice can now be found on the wiki. This topic is to explain how important it is to regularly check on the MTA Server process and it's memory usage and how it can result in server crashes. To keep your server running stable, you should avoid letting your server run unmanaged after you launched it. It is good to keep an eye on the process memory usage in Task manager, use performancebrowser/ipb, if the MTA Server process starts using more than 1.2 gb you're close to an Memory exception and could start thinking about memory leaks, and you should restart the server as it becomes unreliable after this point. Theoretically it could then crash due to an Memory exception (short: running out of memory) Like with every process or application, not all elements and function calls can get efficiently freed. For example, if you start the server, you will have average memory usage of 50mb. If you have some players on it for a while, and all of them disconnected, you will have increased memory usage on the MTA Server process, even if the server returned to the same state (0 players) as it was. This is sometimes described with the term ''software aging'' (google it) It is the leftover from the server's running time and can eventually increase until the server process can become unreliable and has chance of failure, memory exception or in other words, server crashes. To keep it short and simple: Always keep an eye on your servers and restart them once in a while to prevent this from happening, 50% of all server crashes asked support for are caused by it and it's better to be aware that you need this kind of mainentance to ensure stability! In other words: If you launch your server and leave it unmanaged for a long period, it won't hold out and it will crash at a certain point without the mainentance as described above. That means you cannot just start a server and not check back on it, because at one point you'll find it crashed if it gains memory usage over (very) long periods, depending on server load, player counts and other variables. Link to comment
Arran Posted June 25, 2014 Share Posted June 25, 2014 An easy way to same RAM is to not have a silly max player count that you know you'll never reach like 4096 as an empty server with 4096 max players uses a lot more RAM than 100 max players. No average server should reach 1.2gb but you can definitely go to about 1.7gb before it might become a problem. If a server is using over 1gb RAM then then a script probably has a memory leak in which case you should check performancebrowser or IPB and either fix the problem with it, or just keep restarting the resource when it's usage goes up. Or get the new 1.4 64 bit server which can use all the RAM in the device it's being ran on. Though this probably isn't an option for average servers which are with a game hosting company. Don't forget that MTA server could have a memory leak itself, for example: http://bugs.mtasa.com/view.php?id=7565 (Though it's less than 1% chance to be MTA's fault, 99% chance it's your scripts) Link to comment
Deepu Posted December 7, 2014 Share Posted December 7, 2014 @ Arran.. But Arran, having a player peak of 3000 or something will not be a big problem as far as its concerned. For This you just have to keep all variables in local, because just like int, char, and other things like in C++, uses just 2 bytes, but global functions use like 8 bytes or something... A simple example for this:- I created an animation timeframe with about 200 pics for my server.. I scripted it first in locals and worked perfectly... next time i scripted it in Global functions and after 50 pics or something, the MTA server lagged and crashed..... Resulting in a big loss of data.. It was a problem with the memory tunnel. I overloaded the guage.. So sometimes Local works.... Agree or not? Link to comment
ixjf Posted December 10, 2014 Share Posted December 10, 2014 A little off-topic here.. since when is an int 2 bytes? ints are 4 bytes; char and bools are 1 byte. Either way, things are not as simple as declaring everything local. Just saying. Link to comment
tosfera Posted February 14, 2015 Share Posted February 14, 2015 A little off-topic here.. since when is an int 2 bytes? ints are 4 bytes; char and bools are 1 byte. off-topic: Integers used to be 2 bytes in like.. 2010? 2011? But they were changed to 4 byte after because the processors went from 16 bit to 32bit as a min. Link to comment
StifflersMom Posted February 25, 2015 Share Posted February 25, 2015 A little bit more on-topic: We are running a mta-server on linux since 2011 and we had all funny memory side effects, even crashes of the 32bit version. Since we have changed to the 64bit version on linux, we are tracking our uptime more than the memory in case of the "49 days uptime bugs" (some of them are fixed but not all, I think). I'm a little statistics freak, so we graph our memory consumtion and player counts of the mta-server process, so just for fun I provide the memory stats and player counts for the last 4 weeks: Player counts: related to memory consumption: The green graph is VSZ (Virtual Memory Size) and the blue line is RSS (Resident Set Size). The server machine has 32GB RAM. As an example, the server was crashing at week 06 without any dump (we know about out of memory crashing from 32bit versions, mostly, there are no dumps) - We changed at week 06 to r7069 after the crash, but actually, this version uses much more memory ans it's still running. The slightly decreasing of memory use at week 08 was without restarting anything. It has just happened without any reason Also, we had a v1.4-release-6892 64 bit server (for me, it was the stablest version from the sight of the memory consumption) running for more than 49 days without any memory problems. Off-topic: The other issues with more than 49 days uptime we reported here: http://bugs.mtasa.com/view.php?id=8675 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now