WarmRoast - a JVM CPU sampling tool to figure out why a MC server lags

Discussion in 'Bukkit Tools' started by sk89q, Jun 14, 2013.

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

    sk89q

    I wrote a simple web-based JVM CPU sampling tool the other night called WarmRoast, which I find quicker to use and easier to explain than other profilers.

    What it does: It tells you precisely what your server is doing, on average. If you expand out the nodes, you might find, for example, that EntitySheep consumes 24.56% of your server CPU. That might indicate, for example, that your friend has been secretly harboring a large sheep following deep under his "country home" for the past three months. While it is definitely a bit cryptic, poking around enough will let you become familiar with Minecraft's internals, at least to some degree.

    [​IMG]

    Features
    • Open source and easy to use!
    • Adjustable sampling frequency.
    • Supports loading MCP mappings for deobfuscating class and method names (for vanilla and other servers).
    • Web-based — perform the profiling on a remote server and view the results in your browser.
      • Collapse and expand nodes to see details.
      • Easily view CPU usage per method at a glance.
      • Hover to highlight all child methods as a group.
      • See the percentage of CPU time for each method relative to its parent methods.
      • Maintains style and function with use of "File -> Save As" (in tested browsers).
    Requires: Java 7 JDK and SSH/console/desktop access to your server.

    Get WarmRoast
     
  2. Offline

    ImminentFate

    This looks brilliant! Nice work!
     
  3. Offline

    Lolmewn

    That's briliant! You keep on amazing me sk89q :)
     
  4. Offline

    Hoolean

    sk89q

    Have you ever made anything that isn't legendary!

    This is awesome :D
     
  5. Offline

    chaseoes

    Looks great!
     
  6. Offline

    Onionbro

    Good job sk!
     
  7. Offline

    Brahhh

    This would be great for me, but I'm confused on how I would use this if I have my server at a datacenter? This is an amazing idea and will definitely help me. :D
     
  8. Offline

    jorisk322

    Too bad I'm on shared hosting. Would the license allow companies that sell shared hosting to make this available to their clients?
     
  9. Offline

    metalhedd

    I'm trying to run this now but getting the following stack trace with oracle jvm 7:

    Code:
    Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/attach/AttachNotSupportedException
            at java.lang.Class.getDeclaredMethods0(Native Method)
            at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
            at java.lang.Class.getMethod0(Class.java:2694)
            at java.lang.Class.getMethod(Class.java:1622)
            at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
            at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
    Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.AttachNotSupportedException
            at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
            ... 6 more
    
    any tips?
     
    Milkywayz likes this.
  10. Offline

    TheE

    I would guess that you have installed the JRE, and not the JDK. The later one is needed for WarmRoast since it uses some tools provided with it.
     
  11. Offline

    metalhedd

    that sounds about right. I did only have the JRE installed, but I've since also installed the jdk and having the same issue. I think at this point i'm launching it wrong, or possibly not indicating WHERE the jdk is to be found. though I'm really not sure.

    solved, though probably not ideally, i was forced to run this with:

    java -cp /path/to/tools.jar:warmroast.jar com.sk89q.warmroast.WarmRoast

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 2, 2016
  12. Offline

    sk89q

    Thanks, everyone.

    You need some way to run your own programs, which is commonly through SSH for Linux systems, or through command prompt via RDP for Windows.

    Then follow the instructions here:
    https://github.com/sk89q/warmroast/blob/master/README.md

    Yes, it would allow for that.
     
    jorisk322 likes this.
  13. Offline

    MikeA

    Very useful, thanks for making this.
     
  14. Offline

    inventorman101

    That looks very good I like your UI setup!
     
  15. Offline

    Puseidr

    when i want to choose the VM i get this msg:
     
    Milkywayz likes this.
  16. Offline

    Ivan

    The tool itself looks very nice, but how is this any different from JVisualVm, which is built in the Oracle JDK
     
  17. Offline

    sk89q

    1. Run under the same user.
    2. Use the Oracle JDK/JRE.
    JVisualVM isn't usable over a web interface.
     
  18. Offline

    Puseidr

    i have oracle java 1.7_25 JDK and JRE but when i do:
    i get:
     
  19. Offline

    sk89q


    Code:
    -Djava.library.path=/usr/lib/jvm/jdk1.7.0_25/bin
    needs to be
    Code:
    -Djava.library.path=/usr/lib/jvm/jre/jdk1.7.0_25/bin
     
  20. Offline

    Puseidr

    you mean "/usr/lib/jvm/jdk1.7.0_25/jre/bin"?

    Code:
    java -Djava.library.path=/usr/lib/jvm/jdk1.7.0_25/jre/bin -cp /usr/lib/jvm/jdk1.7.0_25/lib/tools.jar:warmroast.jar com.sk89q.warmroast.WarmRoast --thread "Server thread"
    
    but igot the same error
    Code:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no attach in java.library.path
            at java.lang.ClassLoader.loadLibrary(Unknown Source)
            at java.lang.Runtime.loadLibrary0(Unknown Source)
            at java.lang.System.loadLibrary(Unknown Source)
            at sun.tools.attach.LinuxVirtualMachine.<clinit>(LinuxVirtualMachine.java:336)
            at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:78)
            at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:255)
            at com.sk89q.warmroast.WarmRoast.main(WarmRoast.java:282)
    
     
  21. Offline

    sk89q

    Does /usr/lib/jvm/jdk1.7.0_25/jre/bin exist? If so, what is in it?
     
  22. Offline

    Puseidr

  23. Offline

    MikeA

    sk89q How would I define the path on Windows? It doesn't accept defining a drive letter
     
  24. Offline

    Pezmantbh

    Excellent work with this, thank you!
     
  25. Offline

    x0pk1n

    Can we get a better usage guide please?
     
    beefcraft likes this.
  26. Offline

    cnaude

    This is great!
     
  27. Offline

    sk89q

    It should let you define a drive letter. Make sure that you're splitting paths with ; and not : on Windows.



    Where are you getting stuck at?
     
  28. Offline

    MikeA

    I've corrected that issue, however now I get the following error:

    Could not find or load main class com.sk89q.warmroast.WarmRoast

    I'm using the latest Java JDK 7 from Oracle site. Sorry :p
     
  29. Offline

    x0pk1n

    sk89q Step 3, maybe you can put an example up?
     
  30. Offline

    i_pyrex_i

    I get warmroast running, however, the website doesn't show any threads. I do have jdk, and it loads without errors, prompts me to pick the .jars that are running, or the "Server Thread". I pick any, and the website pulls up, with now thread information.
     
Thread Status:
Not open for further replies.

Share This Page