[Ubuntu] Spigot Memory Issues

Discussion in 'Systems Administration' started by Mistri, Jul 12, 2018.

  1. Greetings!

    My friends and I wanted to start up a SMP just for us, with almost no plugins. I own a DigitalOcean Droplet that has 1GB of RAM, and on average around 400MB of those are used by other stuff run on the server.

    Just to be safe, I set the maximum RAM usage of the Spigot server to 400MB. I'm running the server using this command:
    Code (Text):
    java -Xmx400M -XX:+UseConcMarkSweepGC -jar spigot.jar
    Expectation: Spigot runs at no more than 400MB. If there is not enough RAM for some reason (even under 400MB), then the server will cope with this (performance will decrease) but will not crash the server.

    Reality: Every so often, the server is killed. I'm not entirely sure if it is killed at 400MB or below, but either way it's being killed and I don't want that.

    It's being killed by the Linux OOM killer, and I googled how to disable this — I attempted to turn it off by putting this in /etc/sysctl.conf:
    Code (Text):
    vm.oom-kill = 0
    I restarted the server after this change. However, that didn't work. It still continues to be killed when it runs out of memory.

    We'd just like to keep the Spigot server running without being killed when it's out of memory. Any help is appreciated. Thanks!
     
  2. gzx

    gzx

    Linux should only kill the process if it needs to free up memory when it runs out. Do you have swap space enabled?
     
  3. Why do you want to keep it online if it is out of memory? You wouldn't be able to join it or do anything useful with it. Any time you attempt to it will literally just crash.
     
  4. I didn't think of this. Checking my /proc/meminfo, this is what comes up:
    Code (Text):
    MemTotal:        1016020 kB
    MemFree:          183668 kB
    MemAvailable:     219092 kB
    Buffers:            7832 kB
    Cached:           173792 kB
    SwapCached:            0 kB
    Active:           683688 kB
    Inactive:          84688 kB
    Active(anon):     593884 kB
    Inactive(anon):    17672 kB
    Active(file):      89804 kB
    Inactive(file):    67016 kB
    Unevictable:        3652 kB
    Mlocked:            3652 kB
    SwapTotal:             0 kB
    SwapFree:              0 kB
    Dirty:                24 kB
    Writeback:             0 kB
    AnonPages:        590468 kB
    Mapped:            62728 kB
    Shmem:             22352 kB
    Slab:              29196 kB
    SReclaimable:      12644 kB
    SUnreclaim:        16552 kB
    KernelStack:        3904 kB
    PageTables:        12768 kB
    NFS_Unstable:          0 kB
    Bounce:                0 kB
    WritebackTmp:          0 kB
    CommitLimit:      508008 kB
    Committed_AS:    1767132 kB
    VmallocTotal:   34359738367 kB
    VmallocUsed:           0 kB
    VmallocChunk:          0 kB
    HardwareCorrupted:     0 kB
    AnonHugePages:      8192 kB
    CmaTotal:              0 kB
    CmaFree:               0 kB
    HugePages_Total:       0
    HugePages_Free:        0
    HugePages_Rsvd:        0
    HugePages_Surp:        0
    Hugepagesize:       2048 kB
    DirectMap4k:       45036 kB
    DirectMap2M:     1003520 kB
    DirectMap1G:           0 kB

    Seems as if I don't have swap space enabled. Would this work with the Spigot server?

    To my knowledge, if it runs out of memory, it would continue to function but it would be at a slower rate.
     
  5. gzx

    gzx

    Enabling swap space basically lets you treat a portion of the hard drive as if it were RAM, thus giving you more memory (albeit much slower). I think this is the type of behavior you're looking for—allocate more memory to Spigot and enable swap space. Linux won't kill the process because it can swap out memory that's rarely accessed.
     
    • Informative Informative x 1
  6. I've tried this. Thanks very much, I'll let you know if it doesn't work.
     
  7. Huh? Memory is essential for software to function. If a program is literally at the limit, you'd think the program will hang, since it can't do much without having to use more memory; you need to manually kill it.

    Doing this on an SSD is going to wear it out like no tomorrow. Doing this on an HDD will make the server incredibly slow.

    You either need more RAM or you need to change quite a few things in your Spigot configuration. Can you show us your config?
     
  8. It's been working fine for me so far on SSD!

    I'm using the default Spigot config. Any suggestions for optimizations without sacrificing any gameplay experience are welcome :)
     
  9. Well, I don't know any optimizations that don't affect gameplay. If you're okay with it, you can try decreasing the view distance to a number like 3 or 4. You can also try PaperSpigot, a fork of Spigot with even more optimization options. Honestly I think you're better off running the server on your PC.
     

Share This Page