SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 02/02/2020, 01:17 PM   #1
bostonrooted
Little Clucker
 
Join Date: Jan 2020
Location: Macedonia
Posts: 2
Reputation: 0
Default Server optimization

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
bostonrooted is offline   Reply With Quote
Old 02/02/2020, 02:12 PM   #2
Markski
Big Clucker
 
Markski's Avatar
 
Join Date: Apr 2015
Location: La Plata, Argentina
Posts: 133
Reputation: 59
Default Re: Server optimization

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.
Markski is offline   Reply With Quote
Old 02/02/2020, 02:25 PM   #3
bostonrooted
Little Clucker
 
Join Date: Jan 2020
Location: Macedonia
Posts: 2
Reputation: 0
Default Re: Server optimization

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
bostonrooted is offline   Reply With Quote
Old 02/02/2020, 04:48 PM   #4
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 916
Reputation: 89
Default Re: Server optimization

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

https://forum.sa-mp.com/showthread.php?t=271129
Symon is offline   Reply With Quote
Old 03/02/2020, 05:10 AM   #5
Uberanwar
Gangsta
 
Uberanwar's Avatar
 
Join Date: May 2012
Location: Malaysia
Posts: 893
Reputation: 63
Default Re: Server optimization

You can use JIT plugin to further optimize your script.
Uberanwar is offline   Reply With Quote
Old 03/02/2020, 06:23 AM   #6
OsmanMalagic
Little Clucker
 
Join Date: Jul 2016
Location: EX-YU
Posts: 41
Reputation: 51
Default Re: Server optimization

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...
OsmanMalagic is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL Optimization for Server SkyFlare Scripting Help 4 31/01/2019 11:04 AM
Server Optimization Question BrainDamaged Scripting Help 5 09/12/2018 10:53 AM
Server memory optimization introzen Scripting Help 7 04/04/2016 03:53 PM
[HELP] Need some optimization tips for my server xD nGen.SoNNy Scripting Help 8 27/03/2014 07:59 AM
Optimization kLx Help Archive 0 31/01/2010 02:48 PM


All times are GMT. The time now is 03:17 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.