Thread: How to propperly calculate the server load?

Results 1 to 3 of 3
  1. #1 How to propperly calculate the server load? 
    Registered Member
    CTucker's Avatar
    Join Date
    Oct 2008
    Posts
    2,422
    Thanks given
    263
    Thanks received
    281
    Rep Power
    343
    Curious as to how to about properly calculating the server's load? The way I did it (Which I don't believe was working correctly) was the following.

    Code:
    		scheduler.schedule(new Task() {
    			@Override
    			protected void execute() {
    				long startTime = System.currentTimeMillis();
    				itemHandler.process();
    				playerHandler.process();
    				npcHandler.process();
    				shopHandler.process();
    				CycleEventHandler.getSingleton().process();
    				objectManager.process();
    				fightPits.process();
    				pestControl.process();
    				ticks++;
    				long endTime = System.currentTimeMillis();
    				System.out.print("\n[Debug]: Server usage at ["+(int)(((endTime - startTime) / 600) * 100) + "%]"
    						+ "\n[Debug]: Started at : " + startTime 
    						+ "\n[Debug]: Ended at : " + endTime);
    			}
    		});

    I'm not sure if I'm doing this correctly, but it seems that the startTime and the endTime are always equal to one another, and I doubt the entire server is processing in less than 1ms.
    Considering startTime and endTime are always equal, the calculation in the end is equal to 0, displaying 0% server usage.


    Help?
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Jun 2012
    Posts
    467
    Thanks given
    216
    Thanks received
    79
    Rep Power
    0
    Maybe you should check out [Only registered and activated users can see links. ]
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member
    CTucker's Avatar
    Join Date
    Oct 2008
    Posts
    2,422
    Thanks given
    263
    Thanks received
    281
    Rep Power
    343
    Quote Originally Posted by Kelly View Post
    Maybe you should check out [Only registered and activated users can see links. ]

    Dohoho! This looks nice and fancy.

    I would assume that taking the freeMemory() and deviding it by the totalMemory() should give desired results?

    EDIT: Guess not, Java is incapable of basic math, or I'm making a novice mistake due to lack of sleep. Probably the second one.
    EDIT2: It was the second one, Integer Math ftw.

    This does NOT do what I wanted it to by ANY MEANS I was sitting there wondering, how the hell would my server be at 82% load without any players online, and then it dawned on me. I have Eclipse, 3 clients and a Server running, I closed out some cleans and voila, the servers load dropped. This just calculates the JVMs memory-space, not the servers allocated memory.

    Still need help with this
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. pm me how to get onto the server
    By mr nice in forum The Red Carpet
    Replies: 5
    Last Post: 03-12-2013, 06:53 AM
  2. Replies: 3
    Last Post: 12-03-2009, 09:38 PM
  3. how to make you 554 client load server for other players
    By travisman26 in forum Configuration
    Replies: 6
    Last Post: 08-25-2009, 08:59 AM
  4. Replies: 6
    Last Post: 05-29-2009, 08:03 PM
  5. Replies: 5
    Last Post: 05-24-2008, 03:02 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •