albetros use cpu 100%

03/05/2012 11:51 somecode#1
when the player up 50 +........
when the server run three hours ... or a limit time ...
the cpu is use 100%,,,


player's ping is 100000+...

why did that
03/05/2012 11:54 I don't have a username#2
We can't tell it without any info. Did you add anything? If yes, what?
03/05/2012 16:54 pro4never#3
The source is not intended to be used as-is. There's a bunch of things you should consider re-writing if you wish to use it for a public server (can be said about all public sources on epvp).

That being said I haven't experienced such high cpu usage before and we were leaving the source running generally 24 hours per restart.


Likely Causes

Check your main threads. See how long they are taking to execute (use a stopwatch class which displays the MS it takes for each loop. If something is bad in that thread it will show up.)

Re-write the delayed action system. It was only there as a concept for testing. It's NOT intended to be used in a full server as each action = a timer.

Double check any new systems you've coded.


Past that my only small concern is... what type of system are you hosting with? Are you using a very low end VPS? It shouldn't be an issue but all our tests and hosting were done with a.. rather powerful dedicated server.
03/05/2012 18:19 somecode#4
Microsoft Windows server 2003
Intel(R) Core(TM)2 Cpu 6420 @2.13GHz
3.24GB Memory

...
i add a new thread .. Should be no problem..

PHP Code:
public void Run2()
      {
          
DateTime nbc DateTime.Now;
          while (
true)
          {
              try
              {
                  if (
Kernel.Clients.Count 0)
                  {
                      foreach (
Player role in Kernel.Clients.Values)
                      {
                          
//if (role.NobilityRecord != null)
                          
role.Send(role.GetNobilityIconPacket());
                      }
                  }
              }

              catch { }
              
Thread.Sleep(1000);
          }
      } 
03/05/2012 20:51 pro4never#5
.... few issues there...

#1: Before doing anything, switch Kernel.Clients to a threadsafe collection. I thought I had but according to error someone else got, i didn't. Because of that you'll get lots of issues.

#2: Why are you re-sending nobility information to all users every 1 second? There's no need! It updates AS PEOPLE DONATE. If it doesn't then it might have never been fully finished but that doesn't mean you write a wasteful thread to run it constantly... you just fix the system as it should work (async vs sync really here... Only change when it needs to be rather then constantly checking if it does need to be updated... or worse, updating it regardless of changes)
03/06/2012 09:30 somecode#6
Quote:
Originally Posted by pro4never View Post
.... few issues there...

#1: Before doing anything, switch Kernel.Clients to a threadsafe collection. I thought I had but according to error someone else got, i didn't. Because of that you'll get lots of issues.

#2: Why are you re-sending nobility information to all users every 1 second? There's no need! It updates AS PEOPLE DONATE. If it doesn't then it might have never been fully finished but that doesn't mean you write a wasteful thread to run it constantly... you just fix the system as it should work (async vs sync really here... Only change when it needs to be rather then constantly checking if it does need to be updated... or worse, updating it regardless of changes)
no ...

because if a player's donate value= another player's value ... it may be error
03/06/2012 16:37 pro4never#7
So change the existing update code.

What do you mean 'error'? If they both have the same exact amount of silver donated then whoever had the amount first should be ranked higher then them iirc.
03/06/2012 18:20 somecode#8
Quote:
Originally Posted by pro4never View Post
So change the existing update code.

What do you mean 'error'? If they both have the same exact amount of silver donated then whoever had the amount first should be ranked higher then them iirc.
check out you source ...
and setup it ...
i detection a player donate 99999999silver
another player donate 99999999silver
the rank list is wrong like
1 aplayer's name 99999999
1 aplayer's name 99999999
2 aplayer's name 99999998
it take the same rank ....

and ...if i make a npc to donate ... it can't update the rank list
03/06/2012 22:39 pro4never#9
Why on EARTH would you make an npc to donate when there's a full system which handles it already?


That's a very minor issue really... Just change the sorting of ranks and you're good to go.
03/07/2012 09:23 somecode#10
Quote:
Originally Posted by pro4never View Post
Why on EARTH would you make an npc to donate when there's a full system which handles it already?


That's a very minor issue really... Just change the sorting of ranks and you're good to go.
Ok ...i was fixed the bug

it's my dummy_user thread bug

thx-_-!