Server optimization
#1

Hi, I have question for server optimization.
Code lines is 60-70k without maps ( I use them as include ), but in last time I'm focused on memory because I have problems in the last оpenings on my server. I have changed strings size ( much lowered memory ), OnPlayerUpdate I eradicated him from work, I changed most of them from FOR to FOREACH, etc.

My question is: Is my memory good ? How much memory is sufficient on the server, are there possibilities of lag / crash on the server, am I using pragma correctly and give me some tips on how to use the memory.

My memory ( I used pragma dynamic 2000 ):
HTML Code:
Header size:          20900 bytes
Code size:          6723136 bytes
Data size:         30546032 bytes
Stack/heap size:      80000 bytes; estimated max. usage: unknown, due to recursion
Total requirements:37370068 bytes
Thanks
Reply
#2

Memory sizes are meaningless for speed, lowering memory usage won't improve anything since no script will ever use more than 300mb of ram anyways.

What should concern you is performance profilings in order to see how fast your script actually runs. Amount of lines and sizes of string are not important.

You can check how fast your script runs with Profiler plugin.
Reply
#3

Quote:
Originally Posted by Markski
View Post
Memory sizes are meaningless for speed, lowering memory usage won't improve anything since no script will ever use more than 300mb of ram anyways.

What should concern you is performance profilings in order to see how fast your script actually runs. Amount of lines and sizes of string are not important.

You can check how fast your script runs with Profiler plugin.
For lag/crash, the memory has been making problems ? And can you send me profiler setup tutorial in PM ? Thanks
Reply
#4

Well there is no need for a tutorial, everything you need to know is inside the release topic.

https://sampforum.blast.hk/showthread.php?tid=271129
Reply
#5

You can use JIT plugin to further optimize your script.
Reply
#6

My suggestion:

- Optimize your database.
- Fix errors/warnings in server_log.txt and mysql_log.txt...
- Fix bugged/removed fields, tables and queries.
- Remove unnecessary codes from TIMERS.
- Reduce the Strings sizes... to 128, 64, 32, 8 or less. (if possible)
- Sometimes releasing/freeing Long strings(like 1024, 2048...) may helps.
- Convert Public functions to local. (if they are not used in Timers/Callbacks)
- Remove Duplicated codes.
- Try to use FOREACH instead of FOR. (it's faster and improved)
- Try to use ZCMD/IZCMD instead of DCMD and SAMP's callback.
- Delete the log files and remake them.
- Reduce unused/non-rp objects from your maps.
- When writing commands, FIRST you must check if player has Perm to use it, THEN make/set the variables. (such strings)
- Update your plugins and includes.
- Remove Duplicated Objects from your maps.
- Set the "MAX_PLAYERS" to real capacity.
- Remove unused DEFINES from your codes.
and such improvements...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)