Monitoring plugin memory usage, slow - but workable.

Discussion in 'Bukkit Help' started by PhonicUK, Apr 22, 2011.

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

    PhonicUK

    I've been trying to work out how to calculate the total memory usage for each loaded plugin. Turns out that while a mild pain in the ass, it's entirely doable. Here's some output:

    Code:
    2011-04-22 23:20:08 [INFO] Server : 53171 Kb
    2011-04-22 23:20:04 [INFO] Plugin Memory Usage:
    2011-04-22 23:20:04 [INFO] 6 plugins
    2011-04-22 23:20:11 [INFO] Essentials : 8 Kb
    2011-04-22 23:20:15 [INFO] Permissions : 8 Kb
    2011-04-22 23:20:15 [INFO] GroupManager : 9 Kb
    2011-04-22 23:20:15 [INFO] EssentialsProtect : 314 Kb
    2011-04-22 23:20:15 [INFO] EssentialsSpawn : 304 Kb
    2011-04-22 23:20:15 [INFO] BukkitCompat : 1 Kb
    It's done by using a java agent (Requires a extra command line argument and a class) that implements the java Instrumentation interface to get access to the getObjectSize(<object>) method. Internally it uses this recursively to get the total size for an object.

    Be aware that this is very slow. The above output took around 7 seconds to be generated and stalls the server whilst its running - but that said it's still useful for diagnostics.

    Eventually this is going to be shipping as part of the McMyAdmin compatibility plugin to let you see plugin memory usage via the web interface (it will only poll when the user asks to view the data)

    For more information, see http://sourceforge.net/projects/sizeof/
     
    kirtap1001 and codename_B like this.
  2. Offline

    stkeroro

    great!
     
  3. Offline

    Johannes

    I realize this might be a bit much, but could it be possible for you to could give us a quick tutorial on how to use this?
     
  4. Offline

    gameswereus

    I can't wait to see this in action!
     
  5. Offline

    Massimo1993

    @PhonicUK

    sorry but how i can use this for my server?
     
  6. Offline

    PhonicUK

    You can't yet, I've not finished it. It'll be shipping with McMyAdmin once it's ready.
     
  7. Offline

    Trollkemada

  8. Offline

    codename_B

    For example:
    Code:
    java -Xmx320M -Xincgc -javaagent:SizeOf.jar -jar craftbukkit-0.0.1-SNAPSHOT.jar
    
     
  9. Offline

    Donny

    Wonderful idea.
     
  10. Offline

    kirtap1001

    Is this done yet? or is there any way to use it? would need it now since my server is taking alot of memory... need to know what plugin
     
  11. Offline

    Codex Arcanum

    This might help, at least somewhat.
     
Thread Status:
Not open for further replies.

Share This Page