Running a Minecraft server

From BitFolk
Jump to: navigation, search

Some notes on running Minecraft servers at BitFolk.

Challenges

Minecraft server is a relatively heavyweight Java application. It stores a lot of data on disk and tries to keep much of it in RAM. As a result, large amounts of RAM are required, and any swapping will cause noticeable performance problems ("lag").

Is running Minecraft server on a VPS feasible?

From time to time we are asked if it is possible to run a Minecraft server at BitFolk. In order to answer this question we have run a small server on a BitFolk VPS to explore the limits.

The short answer is: Yes, but be realistic.

Test setup

Basics

The initial setup was a VPS with 720MiB RAM and 20GiB disk, running Minecraft server v1.0.1. Once clients started exploring more of the map it became quite laggy and it was determined that this was due to swapping, so RAM was increased first to 960MiB and then to 1,200MiB.

Since running with 1,200MiB performance has been acceptable for less than 10 simultaneous clients.

Server process

Various Java command lines have been experimented with but no real difference in performance was noted, so we settled upon:

$ java -server -XX:+UseConcMarkSweepGC -Xmx700M -Xms700M -jar minecraft_server.jar nogui

After 6 days of operation top looked like this:

top - 04:58:48 up 6 days, 12:21,  6 users,  load average: 1.00, 1.06, 1.10
Tasks:  75 total,   1 running,  74 sleeping,   0 stopped,   0 zombie
Cpu(s): 11.8%us,  2.2%sy,  0.0%ni, 85.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.2%st
Mem:   1201524k total,  1174500k used,    27024k free,     2580k buffers
Swap:   730948k total,   315768k used,   415180k free,   133088k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                           
 1240 minecraf  20   0 1444m 967m 4080 S 19.9 82.4   1661:17 java -server -XX:+UseConcMarkSweepGC -Xmx700M -Xms700M -jar minecraft_server.jar nogui

Performance graphs

IOPS on root disk; green is read, orange is write
IOPS on swap disk; green is read, orange is write
Memory usage; purple is free memory, light orange is cached memory

The map

At the time of writing, 20,267 chunks were explored.