EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::Linux Servers (https://www.eqemulator.org/forums/forumdisplay.php?f=588)
-   -   cpu lag (https://www.eqemulator.org/forums/showthread.php?t=28861)

Dolrese 07-11-2009 05:34 PM

cpu lag
 
ok guys i have a prob i just set my server up on new hosting and im having issuse everything copiled correctly then i turned it on and i get lag on a really nice 100 meg connection. it only some zones though but there ones that worked just fine with the old server setup. the server specs are close tot he same the new one abit slower because it has 1 less processor.

i was running Debian with no probs sept had a bad connection the new connection i am using centos 5.0.

this is what i get when i run the top command

http://i903.photobucket.com/albums/a...der661/top.jpg

that's with only 40 or so players get more then that and the average load goes up to 50-70 that's bogging down the zones. now see mysql there.. we are thinking from the checks we have made that is is mysql making to many calls at a time and stuff slowing it down and having to wait inline to make new calls but not 100% sure..

basically we are not 100% sure what is going on and wondering if anyone else has had or is haveing this problem and came to any conclusions.. let me know any info you need and i can get it posted here also. if it makes it easyer for you rather then talking on the forums we have a vent we can use to talk mic or no mic we still have live chat.. anyways let me know.

gaeorn 07-12-2009 05:41 PM

It is very difficult to diagnose a performance problem under linux with just one screenshot of top. There are simply too many factors. However, I can give you some pointers as to where to look.

Since this ran well on a prior server, I would look for any differences between the two systems. You said the new one is missing one CPU, but since in that screenshot you are showing 45% idle time, that is less likely to be the issue. Have you looked at the performance numbers for the hard disk to see if it differs significantly from the old system? Is MySQL configured exactly the same with all the same table types, etc., as the old system?

Just look for anything that is different, no matter how slight a change. One (or more) of those changes should be the cause.

pfyon 07-12-2009 05:55 PM

You could check the configuration for mysql, or do some diagnostics on the queries being used. How many threads is mysql set up to use? Could be a thrashing problem, but who knows without a bit more looking.

trevius 07-12-2009 06:16 PM

Is this for SoA? Just curious, because I got a PM on my forums about a similar issue with them, and I don't want to work the same issue from here and through PM at the same time.

What revision of source is the server running? A while back, there was a few versions put up that had a particularly nasty loop in the code that was driving CPU utilization way up. Also, have you tried checking the logs to see if this might be something related to a quest script gone wrong?

Check the following function in Hatelist.cpp and verify that the iterator.Advance(); in red is in your source:

Code:

Mob *HateList::GetTop(Mob *center)
{
        _ZP(HateList_GetTop);
        Mob* top = NULL;
        sint32 hate = -1;
       
        if (RuleB(Aggro,SmartAggroList)){
                Mob* topClientInRange = NULL;
                sint32 hateClientInRange = -1;
                LinkedListIterator<tHateEntry*> iterator(list);
                iterator.Reset();
                while(iterator.MoreElements())
                {
                tHateEntry *cur = iterator.GetData();
                        sint16 aggroMod = 0;

                        if(!cur){
                                iterator.Advance();
                                continue;
                        }                     

                        if(!cur->ent){
                                iterator.Advance();
                                continue;
                        }

                        if(cur->ent->DivineAura() || cur->ent->IsMezzed()){
                                if(hate == -1)
                                {
                                        top = cur->ent;
                                        hate = 0;
                                }
                              iterator.Advance();
                                continue;
                        }

                        sint32 currentHate = cur->hate;

                        if(cur->ent->IsClient()){
                               
                                if(cur->ent->CastToClient()->IsSitting()){
                                        aggroMod += RuleI(Aggro, SittingAggroMod);
                                }

                                if(center){
                                        if(center->GetTarget() == cur->ent)
                                                aggroMod += RuleI(Aggro, CurrentTargetAggroMod);
                                        if(RuleI(Aggro, MeleeRangeAggroMod) != 0)
                                        {
                                                if(center->CombatRange(cur->ent)){
                                                        aggroMod += RuleI(Aggro, MeleeRangeAggroMod);

                                                        if(currentHate > hateClientInRange || cur->bFrenzy){
                                                                hateClientInRange = currentHate;
                                                                topClientInRange = cur->ent;
                                                        }
                                                }
                                        }
                                }

                        }
                        else{
                                if(center){
                                        if(center->GetTarget() == cur->ent)
                                                aggroMod += RuleI(Aggro, CurrentTargetAggroMod);
                                        if(RuleI(Aggro, MeleeRangeAggroMod) != 0)
                                        {
                                                if(center->CombatRange(cur->ent)){
                                                        aggroMod += RuleI(Aggro, MeleeRangeAggroMod);
                                                }
                                        }
                                }
                        }

                        if(cur->ent->GetMaxHP() != 0 && ((cur->ent->GetHP()*100/cur->ent->GetMaxHP()) < 20)){
                                aggroMod += RuleI(Aggro, CriticallyWoundedAggroMod);
                        }

                        if(aggroMod){
                                currentHate += (currentHate * aggroMod / 100);
                        }

                        if(currentHate > hate || cur->bFrenzy){
                                hate = currentHate;
                                top = cur->ent;
                        }

                        iterator.Advance();
                }

                if(topClientInRange != NULL && top != NULL && !top->IsClient())
                        return topClientInRange;
                else
                        return top;
        }
        else{
                LinkedListIterator<tHateEntry*> iterator(list);
                iterator.Reset();
                while(iterator.MoreElements())
                {
                tHateEntry *cur = iterator.GetData();
                        if(cur->ent != NULL && ((cur->hate > hate) || cur->bFrenzy ))
                        {
                                top = cur->ent;
                                hate = cur->hate;
                        }
                        iterator.Advance();
                }
                return top;
        }
}

This was fixed in R472, and was introduced in R458. So, if your server is running code between those 2 revisions, either try updating and see if it fixes it, or simple adding the iterator as shown in red above should fix it.

I am not aware of any other bugs causing high CPU utilization recently.


All times are GMT -4. The time now is 07:32 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.