List Info

Thread: gaining server speed




gaining server speed
user name
2006-06-20 19:53:21
Hello,

I'm not sure how to understand the part about feature freeze in last meeting notes.
So here's a question on if I should submit it or not.

I implemented a simple task switcher in the RulesProcessor's endTurn:

synchronized public void endTurn() {
        Log4J.startMethod(logger, "endTurn");
        long start = System.nanoTime();
        int aktTurn = getTurn();
        try {
            for (RespawnPoint point : respawnPoints) {
                point.logic();              
            }
            switch (aktTurn % 5) {
                case 4:
                    for (RespawnPoint point : respawnPoints)
                        point.checkRespawn(aktTurn);
                    break;
                case 3:
                    for (PlantGrower plantGrower : plantGrowers)
                        plantGrower.regrow(aktTurn);
                    break;
                case 2:
                    for (Corpse corpse : corpses)
                        corpse.logic(aktTurn);
                    break;
                case 1:
                    for (Blood blood : bloods)
                        blood.logic(aktTurn);
                    break;
                default:
                    for (Door door : doors) {
                        door.logic(aktTurn);
                    }
                    break;
            }
            scripts.logic();
        } catch (Exception e) {
            logger.error("error in endTurn", e);
        } finally {
            logger.debug("End turn: " + (System.nanoTime() - start) / 1000000.0 + " (" + (aktTurn % 5) + ")");
            Log4J.finishMethod(logger, "endTurn");
        }
    }

and changed the classes that are called from here.

I changes Respawn point to split between NPC.logic() and respawn logic and changed all functions called in the switch statement so they work in the expected way even if they are not called every turn.

The result of the work based on debug output in the same timeframe since server restart is:

before the change: 

27163 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 48.763
27475 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 59.88
27747 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 30.956
28042 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 25.506
28367 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 49.897
28643 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 25.122
28944 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 25.514
29245 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 25.56
29577 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 56.59
29861 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 37.79
30162 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 36.788
30479 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 52.618

after the change:

27230 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 23.367 (2)
27534 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 26.395 (3)
27853 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 44.554 (4)
28133 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 23.71 (0)
28434 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 23.408 (1)
28734 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 23.63 (2)
29051 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 39.153 (3)
29340 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 27.841 (4)
29636 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 22.706 (0)
29951 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 37.32 (1)
30237 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 22.881 (2)
30538 DEBUG  games.stendhal.server.StendhalRPRuleProcessor  - End turn: 23.527 (3)

it's not a major breakthrough but should give us a little air to breathe and the possibility to optimize it even more.

I checked all the functionality that is involved with the functions and all is working normal it seems.

So, do we have a code freeze or shall I submit it?

Regards,
Jo



 

gaining server speed
user name
2006-06-20 22:01:54
Hi Jo,

I would like to release 0.51 tomorrow.
If you feel confident about that it works correctly, just
commit it. 

Anyway IMHO it doesn't hit the main problem that is
Creature.logic
Most of time is wasted there checking if there is a player
around and 
calling pathfinding.
I were working on A* pathfinding to fix the issue of no
detecting players, 
but I have failed ( again ). I will try again tomorrow. ( I
know I can do it 
:P )

On Creatures.logic at the end is resolved the attack and
move actions of the 
creature, now I see that this is a terrible mistake and that
the resolution 
of the action should be split in a similar way it is done
with players.

And about server paralelization, keep in mind that it
wasn't done to be 
paralelized, so concurrent access problems may appear due to
design that 
need to be fixed on design.

Regards,
Miguel

>From: Jo Seiler <jo.seilergmx.de>
>Reply-To: arianne-devellists.sourceforge.net
>To: arianne-devellists.sourceforge.net
>Subject: [Arianne-devel] gaining server speed
>Date: Tue, 20 Jun 2006 21:53:21 +0200
>
>Hello,
>
>I'm not sure how to understand the part about feature
freeze in last  
>meeting notes.
>So here's a question on if I should submit it or not.
>
>I implemented a simple task switcher in the
RulesProcessor's endTurn:
>
>	synchronized public void endTurn() {
>         Log4J.startMethod(logger,
"endTurn");
>         long start = System.nanoTime();
>         int aktTurn = getTurn();
>         try {
>             for (RespawnPoint point : respawnPoints) {
>                 point.logic();
>             }
>             switch (aktTurn % 5) {
>                 case 4:
>                     for (RespawnPoint point :
respawnPoints)
>                         point.checkRespawn(aktTurn);
>                     break;
>                 case 3:
>                     for (PlantGrower plantGrower :
plantGrowers)
>                         plantGrower.regrow(aktTurn);
>                     break;
>                 case 2:
>                     for (Corpse corpse : corpses)
>                         corpse.logic(aktTurn);
>                     break;
>                 case 1:
>                     for (Blood blood : bloods)
>                         blood.logic(aktTurn);
>                     break;
>                 default:
>                     for (Door door : doors) {
>                         door.logic(aktTurn);
>                     }
>                     break;
>             }
>             scripts.logic();
>         } catch (Exception e) {
>             logger.error("error in
endTurn", e);
>         } finally {
>             logger.debug("End turn: " +
(System.nanoTime() -  start) / 
>1000000.0 + " (" + (aktTurn % 5) +
")");
>             Log4J.finishMethod(logger,
"endTurn");
>         }
>     }
>
>and changed the classes that are called from here.
>
>I changes Respawn point to split between NPC.logic() and
respawn  logic and 
>changed all functions called in the switch statement so 
they work in the 
>expected way even if they are not called every turn.
>
>The result of the work based on debug output in the same
timeframe  since 
>server restart is:
>
>before the change:
>
>27163 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>48.763
>27475 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>59.88
>27747 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>30.956
>28042 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>25.506
>28367 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>49.897
>28643 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>25.122
>28944 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>25.514
>29245 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>25.56
>29577 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>56.59
>29861 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>37.79
>30162 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>36.788
>30479 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>52.618
>
>after the change:
>
>27230 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>23.367 (2)
>27534 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>26.395 (3)
>27853 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>44.554 (4)
>28133 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>23.71 (0)
>28434 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>23.408 (1)
>28734 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>23.63 (2)
>29051 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>39.153 (3)
>29340 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>27.841 (4)
>29636 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>22.706 (0)
>29951 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>37.32 (1)
>30237 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>22.881 (2)
>30538 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End  turn: 
>23.527 (3)
>
>it's not a major breakthrough but should give us a
little air to  breathe 
>and the possibility to optimize it even more.
>
>I checked all the functionality that is involved with
the functions  and 
>all is working normal it seems.
>
>So, do we have a code freeze or shall I submit it?
>
>Regards,
>Jo
>
>
>
>
>




>_______________________________________________
>Arianne-devel mailing list
>Arianne-devellists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/arianne-d
evel




_______________________________________________
Arianne-devel mailing list
Arianne-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/arianne-d
evel
gaining server speed
user name
2006-06-20 22:52:11
It's a start to prepare the next step ;)

The time consumed in creature.logic, as well as in
speaker.npc can be  
speeded up a lot, if we start keeping track of the players
in a zone.  
right now all of that loops through all players in the
world. that  
would speed those things up a lot.

i agree about the split of attack and move actions,
especially as  
attack damage is only done every 5 turns.
that's another next step ;)

we'll be getting there.

anyway, I'm confident about my changes. works well, killed
and  
respawned a lot of things, looked at all the corpses, blood
and the  
plant regrowers  only thing
i didn't test was doors, because i miss  
the testcase.

good night everyone 




Am 21.06.2006 um 00:01 schrieb Miguel Angel Blanch Lardin:

> Hi Jo,
>
> I would like to release 0.51 tomorrow.
> If you feel confident about that it works correctly,
just commit  
> it. 
>
> Anyway IMHO it doesn't hit the main problem that is
Creature.logic
> Most of time is wasted there checking if there is a
player around and
> calling pathfinding.
> I were working on A* pathfinding to fix the issue of no
detecting  
> players,
> but I have failed ( again ). I will try again tomorrow.
( I know I  
> can do it
> :P )
>
> On Creatures.logic at the end is resolved the attack
and move  
> actions of the
> creature, now I see that this is a terrible mistake and
that the  
> resolution
> of the action should be split in a similar way it is
done with  
> players.
>
> And about server paralelization, keep in mind that it
wasn't done  
> to be
> paralelized, so concurrent access problems may appear
due to design  
> that
> need to be fixed on design.
>
> Regards,
> Miguel
>
>> From: Jo Seiler <jo.seilergmx.de>
>> Reply-To: arianne-devellists.sourceforge.net
>> To: arianne-devellists.sourceforge.net
>> Subject: [Arianne-devel] gaining server speed
>> Date: Tue, 20 Jun 2006 21:53:21 +0200
>>
>> Hello,
>>
>> I'm not sure how to understand the part about
feature freeze in last
>> meeting notes.
>> So here's a question on if I should submit it or
not.
>>
>> I implemented a simple task switcher in the
RulesProcessor's endTurn:
>>
>> 	synchronized public void endTurn() {
>>         Log4J.startMethod(logger,
"endTurn");
>>         long start = System.nanoTime();
>>         int aktTurn = getTurn();
>>         try {
>>             for (RespawnPoint point :
respawnPoints) {
>>                 point.logic();
>>             }
>>             switch (aktTurn % 5) {
>>                 case 4:
>>                     for (RespawnPoint point :
respawnPoints)
>>                        
point.checkRespawn(aktTurn);
>>                     break;
>>                 case 3:
>>                     for (PlantGrower plantGrower :
plantGrowers)
>>                        
plantGrower.regrow(aktTurn);
>>                     break;
>>                 case 2:
>>                     for (Corpse corpse : corpses)
>>                         corpse.logic(aktTurn);
>>                     break;
>>                 case 1:
>>                     for (Blood blood : bloods)
>>                         blood.logic(aktTurn);
>>                     break;
>>                 default:
>>                     for (Door door : doors) {
>>                         door.logic(aktTurn);
>>                     }
>>                     break;
>>             }
>>             scripts.logic();
>>         } catch (Exception e) {
>>             logger.error("error in
endTurn", e);
>>         } finally {
>>             logger.debug("End turn: " +
(System.nanoTime() -   
>> start) /
>> 1000000.0 + " (" + (aktTurn % 5) +
")");
>>             Log4J.finishMethod(logger,
"endTurn");
>>         }
>>     }
>>
>> and changed the classes that are called from here.
>>
>> I changes Respawn point to split between
NPC.logic() and respawn   
>> logic and
>> changed all functions called in the switch
statement so  they work  
>> in the
>> expected way even if they are not called every
turn.
>>
>> The result of the work based on debug output in the
same  
>> timeframe  since
>> server restart is:
>>
>> before the change:
>>
>> 27163 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 48.763
>> 27475 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 59.88
>> 27747 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 30.956
>> 28042 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 25.506
>> 28367 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 49.897
>> 28643 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 25.122
>> 28944 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 25.514
>> 29245 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 25.56
>> 29577 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 56.59
>> 29861 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 37.79
>> 30162 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 36.788
>> 30479 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 52.618
>>
>> after the change:
>>
>> 27230 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 23.367 (2)
>> 27534 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 26.395 (3)
>> 27853 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 44.554 (4)
>> 28133 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 23.71 (0)
>> 28434 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 23.408 (1)
>> 28734 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 23.63 (2)
>> 29051 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 39.153 (3)
>> 29340 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 27.841 (4)
>> 29636 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 22.706 (0)
>> 29951 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 37.32 (1)
>> 30237 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 22.881 (2)
>> 30538 DEBUG 
games.stendhal.server.StendhalRPRuleProcessor  - End   
>> turn:
>> 23.527 (3)
>>
>> it's not a major breakthrough but should give us a
little air to   
>> breathe
>> and the possibility to optimize it even more.
>>
>> I checked all the functionality that is involved
with the  
>> functions  and
>> all is working normal it seems.
>>
>> So, do we have a code freeze or shall I submit it?
>>
>> Regards,
>> Jo
>>
>>
>>
>>
>>
>
>
>
>
>> _______________________________________________
>> Arianne-devel mailing list
>> Arianne-devellists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/arianne-d
evel
>
>
>
>
> _______________________________________________
> Arianne-devel mailing list
> Arianne-devellists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/arianne-d
evel
>



_______________________________________________
Arianne-devel mailing list
Arianne-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/arianne-d
evel
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )