Java Profiler results...

Discussion in 'Bukkit Help' started by Zachar543, Aug 12, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Zachar543

    (I'm not sure where I should put this question as I don't really see a place for it.)
    I have been programming java for 1 year or so (C# and Lua for 3-4 years before) and this is really the first time that I have picked up a java profiler. (after noticing that my server's CPU usage was pretty high for the number of players online)
    Would running the profiler cause all operations to take an abnormal amount of time? I have found some, what I believe to be, large numbers for some methods...


    Code:
    net.minecraft.server.MinecraftServer.World.doTick(): 2,615ms (4 calls) (26% of the 75% CPU usage)
    org.bukkit.craftbukkit.util.LongHash.containsKey(int, int): 920ms (1 call) (9% of the 75% CPU usage)
    net.minecraft.server.World.save(boolean, IProgressUpdate): 910ms (1 call) (9% of the 75% CPU usage)
    net.minecraft.server.MinecraftServer.run() ->
                 -> Thread.sleep(long): 5,193ms (7 calls) (53% of the 75% CPU usage)
    net.minecraft.server.BlockStationary.a(World, int, int, int, Random) ->
                 -> Random.nextInt(int): 783ms (1 call) (8% of the 75% CPU usage)
    

    These all combine together, plus more, to use around 75% of my 2.5GHz processor (VPS) with an average of 4 people online... Even when there isn't a profiler running. Is this in anyway normal? Should these numbers be this high or are they being slowed by the profiler?​
     
  2. Offline

    Supersam654

    Can't you figure out what your processor usage is without running a profiler? Also, what version of Bukkit are you running? Although your CPU usage is very high, knowing what your CPU usage is when Minecraft isn't running and when the profiler isn't running would be very helpful. Also, I ask about your bukkit build because some (older) versions of Minecraft have been known to be HUGE processor hogs.
     
  3. Offline

    Zachar543

    I have tried builds from 968->1041. I was using the profiler to try and find what inside craftbukkit was using so much CPU. The java process is using 75% with or without the profiler. (Depends on the number of people... This test was with about 4 people and seems to be the average CPU usage for most of the day.)
     
  4. Offline

    Supersam654

    For starters, stick with the recommended build of 1000, it will save you headaches in the long run. Have you tried running your server without the craftbukkit wrapper? This will prove if it is a Minecraft thing or a Bukkit thing.
     
  5. Offline

    Zachar543

    It appears that it still happens even with a default Minecraft server jar file. My friend is having the same issue when it comes to this with similar results. It appears that simple methods that should not take very long to run are taking 1/2 a second to 1 full second to finish being called. Is this an issue with my server? I have tried this on a VirtualBox on my computer too, Same problem as before but less severe. Could it be a problem with Linux? (I have tried CentOS and Ubuntu 10.04)
     
  6. Offline

    Supersam654

    Try updating Java to the latest version of version 6 or move onto 7 (you will need to slightly change your .bat launcher file if you move to Java 7). Also, you never answered my question about your processor usage when Minecraft is not running.
     
  7. Offline

    Zachar543

    I have tried OpenJDK 1.6, and Sun 1.7. Processor usage when minecraft is not running is near zero. The java process is using it all.
     
  8. Offline

    xpansive

    Just wondering, what profiler are you using? Would it be possible to use it on a plugin only? I'm currently writing a world generator and am looking for any possible way to speed it up.
     
  9. Offline

    Zachar543

    I used the YourKit 15 day trial and then started using VisualVM when the 15 days were up. With the profiler, it tells you the methods being called, number of calls, and time spent for all the calls. You can find your plugin in the list easier if it uses a lot of CPU time
     
Thread Status:
Not open for further replies.

Share This Page