MemCheck 1.01

Output CraftBukkit/Spigot memory statistics

  1. Bobcat00
    Native Minecraft Version:
    1.13
    Tested Minecraft Versions:
    • 1.12
    • 1.13
    • 1.14
    • 1.15
    Source Code:
    https://github.com/Bobcat00/MemCheck
    Description

    Want to find out how much heap space your server really needs? Want to check that your hosting provider is giving you what you paid for? Other plugins, such as Essentials, will provided memory statistics, but they're probably not what you really want to know. MemCheck provides the amount of heap used and the total amount of free heap space in real time. It's designed for use with Java 8.

    MemCheck adds a /mem command which outputs the amount of used heap in MB and as a percentage of the maximum heap size, and the total free heap in MB. It also provides statistics about the Java "Metaspace" use. As a bonus, the server's current TPS as calculated by Essentials, the CPU load, and the average garbage collection time in the previous minute are shown.

    At startup, the number of processors (threads), total physical memory, maximum heap, server view distance, and Java command line options are written to the server log file.

    This allows the server owner to see how much memory is being used and if the memory available for additional objects is too small, too big, or just right.

    Details

    I discovered that the memory values reported by Essentials come directly from Java, and don't really show what a server owner needs to know. The explanation will be easier with the help of the following diagram I stole from Stackoverflow:

    java_memory2.png

    Java provides, and Essentials reports, the three values shown in red. This is not really what a server owner needs. The more relevant values are the two shown in blue at the bottom: used, which is the amount of the heap currently used by the program, and totalFree, which is the amount of memory available for additional objects on the heap. More information is shown below.

    Commands

    /mem - This outputs the current memory statistics. Note that the heap is constantly changing, so you'll see the values change from second to second, as more objects are allocated or the Java garbage collector runs.

    mem_sample.png

    The output includes the following:
    • General:
      • TPS - If you're also running Essentials, the current TPS will be output.
      • CPU - The current CPU load as a percentage of all available cores.
      • GC - The average time needed to run the garbage collector, updated once per minute.
    • Heap:
      • Heap used - The current amount of heap space used by your server.
      • Free - The amount of additional heap space available, up to the maximum allowed.
      • Alloc - The amount of heap space currently allocated. This is useful if you specify an -Xms values that is less than -Xmx. It tells you how much heap space Java thinks is necessary.
    • Metaspace:
      • Metaspace used - The current amount of Metaspace used by your server.
      • Free - If a maximum value for the Metaspace has been given, this shows the amount which is free.
      • Alloc - The amount of Metaspace currently allocated.
    Permissions

    memcheck.mem - Required to use the mem command. Defaults to op.

    Configuration

    None.

    Miscellaneous

    This plugin uses the bStats metrics system to provide anonymous usage data. You may opt-out globally by changing plugins/bStats/config.yml. The metrics are available at https://bstats.org/plugin/bukkit/MemCheck
    Resoluciones likes this.

Recent Updates

  1. Add view distance to startup log