Jump to content
  • 0

Checking script


chowking

Question


  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.01
  • Content Count:  178
  • Reputation:   16
  • Joined:  06/25/12
  • Last Seen:  

how to check a script if its a performance killer or not?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

you have to do this manually though

prontera,155,185,3	script	kdfhksjfhs	100,{
	.@time = gettimetick(0);
	for ( .@i = 0; .@i < 1000; .@i++ )
		dispbottom "test"+ .@i;
	debugmes "this script use "+ ( gettimetick(0) - .@time ) +" mili-seconds to run";
	end;
}
[Debug]: script debug : 2000000 110000159 : this script use 15 mili-seconds to run
1st thing that you need to have in mind is that

http://rathena.org/board/tracker/issue-6804-party-member-loop-issue-in-script-commandstxt/

when a server runs a script, all cpu power is dedicated to execute the script

I can think of several ways to slow down script execution time

no. 1, when you see the script commands in script.c,

anything that has clif*, sending packets to client, that definitely slow down the time

no. 2 ... query_sql ... this one I no need explain because if you ask this question, you sure know what it can do

actually, in fact I made an unfinished guide pinned at eathena forum

http://www.eathena.ws/board/index.php?s=&showtopic=181741&view=findpost&p=1478950

over there,

no.1 method is trying to simulate a permanent server array to store player data ...

no.2 is using freeloop wrongly

no.3 is runs a query_sql that takes > 5 seconds to execute

<-- yeah I think I never say that in that topic, so I tell here

in my test server, whenever a query_sql runs more than 5 seconds, map_server.exe hang

I have 3 experiences that query_sql can kill a server

no.1 is joshuali eamyadmin, trying to delete old account from a live server

no.2 is my old character logging system ... dunno why he said it caused lag

no.3 is run a query_sql "insert into ... select" to gives every player an item .. in a large table his server used 13 seconds

that's why we always suggest to shut down your server and in order to execute a long Sql query

partly because of this reason

I think there's also a topic in the past

http://www.eathena.ws/board/index.php?showtopic=237976

EDIT: didn't see your post

@-SkittleNugget-

I have tested that, setting too many variables will not hurt the server at all

because every variables are being store in RAM

it updates is interval

this one store character data

// Database autosave time

// All characters are saved on this time in seconds (example:

// autosave of 60 secs with 60 characters online -> one char is saved every

// second)

autosave_time: 300

// Min database save intervals (in ms)

// Prevent saving characters faster than at this rate (prevents char-server

// save-load getting too high as character-count increases)

minsave_time: 100

// Apart from the autosave_time, players will also get saved when involved

// in the following (add as needed):

// 1: after every successful trade

// 2: after every vending transaction

// 4: after closing storage/guild storage.

// 8: After hatching/returning to egg a pet.

// 16: After successfully sending a mail with attachment

// 32: After successfully submitting an item for auction

// 64: After successfully get/delete/complete a quest

// 128: After every bank transaction (deposit/withdraw)

// NOTE: These settings decrease the chance of dupes/lost items when there's a

// server crash at the expense of increasing the map/char server lag. If your

// server rarely crashes, but experiences interserver lag, you may want to set

// these off.

save_settings: 255

and this one store permanent server variable -> $var

// How often should the server save guild infos? (In seconds)

// (character save interval is defined on the map config (autosave_time))

autosave_time: 60

you can manually adjust them

btw remember that we already have check_goto_count to prevent infinite loop

so unless the script has freeloop or query_sql, I don't think that's enough to kill a server

Edited by AnnieRuru
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  318
  • Reputation:   54
  • Joined:  12/23/12
  • Last Seen:  

You can judge if it's a performance killer if it has either, too many variables, or too many mistakes (check map server console) or it's written In a format that is not nessesary (typing 20 lines just to make an NPC say hello.)

Usually one NPC is not enough to kill performance since it's such a small usage, but they all add up.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.01
  • Content Count:  178
  • Reputation:   16
  • Joined:  06/25/12
  • Last Seen:  

thank you for the responses, learned a lot from your post @AnnieRuru, will definitely do that, thanks

EDIT: definitely need to recheck all my custom scripts

Edited by chowking
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...