By · Updated

Load test a Minecraft server with bots before launch

2files
7min read
Sheet 17 of 20 · server owners

Filesserver.properties · bukkit.yml

Fileserver.propertiesFilebukkit.ymlThe only reliable way to know how many players a Paper server holds is to put that many clients on a copy of it, have them do what players do, and watch the tick time. TPS alone hides the answer: it stays at 20 until the server is already out of headroom. Watch MSPT, the milliseconds each tick takes, against the 50 ms budget a tick has at 20 TPS, and run the test long enough to see whether it creeps up.

What to measure

NumberWhat it tells youWhere it comes from
MSPTHow much of the 50 ms tick budget is used. Under 50 the server keeps 20 TPSPaper's /mspt, spark tps
TPSWhether ticks are being skipped. Drops only once MSPT passes 50/tps, spark tps
PingNetwork and netty load, and whether the main thread is late answeringThe client, keep-alive packets
Menu open timeHow long a command takes to show its window under loadTimed from the command to the window opening
Heap over timeLeaks. A heap whose floor keeps rising runs out sooner or laterspark health

Paper's /tps is an average over a minute or more, so a short spike barely moves it. MSPT reacts faster, and a spark profile tells you which plugin the time went to. Paper bundles spark since 1.21, so spark profiler start and spark profiler stop work on a plain Paper server.

Set up a copy, not production

    1. Copy the server

      Same jar, same plugins, same configs, same world. A test on an empty world with half the plugins tells you about a different server.

    2. Let bots in

      Fileserver.propertiesBots usually join with offline names, which needs online-mode=false in server.properties. Keep that copy off the internet, behind a firewall or bound to localhost.

    3. Give the bots permissions

      Put them in a LuckPerms group with the same permissions a normal player has, so they hit the same code paths.

    4. Turn off what blocks a crowd from one address

      Config keysettings.connection-throttleFilebukkit.ymlWhen the bots run on another machine, settings.connection-throttle in bukkit.yml (4000 ms by default) can refuse joins from one address that come faster than that, and anti-bot plugins see a hundred joins from one IP as an attack. Set the throttle to -1 and relax the anti-bot limits on the test copy only.

    5. Take a baseline

      Note MSPT and heap with nobody online, so you know what the bots added.

Idle bots lie

A bot that joins and stands still costs the server little: a player entity, the chunks around it and some packets. Real players open menus, run commands, walk, fight and chat, and that is where plugins spend their time. Three runs cover most of it:

  • One action, many bots. Forty bots opening the shop menu every second and a half finds the command that does a database read on the main thread.
  • Mixed play. Bots walking, chatting and opening menus in turn is closer to a normal evening.
  • Hours, not minutes. A leak or a cache that never empties only shows after hours. MSPT that is fine at minute five and 30 percent higher at hour two is the finding.

One limit to keep in mind: bots that walk a few blocks around spawn do not explore. If your players fly off into new terrain, chunk generation is a cost your test is not paying, so generate the world in advance or test that separately.

Run it with IgniteTestTool

Config keyapi-token.txtIgniteTestTool is our tool for this. Its bots are protocol clients that join a real Paper server, and it runs two kinds of load test from its window or over its local HTTP API. Start it headless with java -jar IgniteTestTool-1.3.0.jar --headless --api-port 8767; the examples use that port. Calls that make bots act need the token from api-token.txt in the data folder, sent as X-ITT-Token.

A load run: one thing, many bots

curl -H "X-ITT-Token: $TOKEN" "localhost:8767/load/start?count=40&actions=menu&cmd=/shop&duration=100s&interval=1500ms"
curl "localhost:8767/load/status"
curl "localhost:8767/load/report?format=html" > report.html

Forty bots join as Load_1 to Load_40, 250 ms apart, then each runs /shop every 1.5 seconds (give or take 20 percent) for 100 seconds and the tool times how long the window takes to open. A run takes up to 500 bots. actions picks what they do:

actionsEach bot
idleStays online
chatSends a line
menuRuns cmd and times the window
walkWalks a few blocks
mixedRotates menu, chat and walk
a scenario namePlays that scenario once per round

With health=auto (the default) the tool asks the server console for tps and mspt every 5 seconds, and spark tps if those give nothing. Add spark=1 and it runs spark profiler start before the run and spark profiler stop plus a health report after it, and puts the links in the report.

The report has the join success rate and join times, menu open p50, p95 and max, errors, and TPS, MSPT and ping over time, as one HTML file with its charts inline. Server errors logged during the run are in it too, which is often where the real finding is. The details are on Load Runs.

A soak run: hours of play

curl -g -H "X-ITT-Token: $TOKEN" "localhost:8767/soak/start?count=10&duration=2h&profile=mixed&seed=42&menus=/is|/warp"
curl "localhost:8767/soak/report?format=html" > soak.html

Soak bots walk with pathfinding, dig and place blocks, open the menus you list, chat, pick items up, sleep at night and now and then quit and rejoin. survival roams 20 blocks, skyblock stays within 6 and builds more, mixed splits the swarm. A seed makes every bot make the same choices on the next run, so a before and after comparison is fair.

Every 30 seconds the report samples bots online, TPS, MSPT, server and tool heap, ping, disconnects and menu open p95. At the end it flags four trends:

TrendFlagged when
TPS decayThe last quarter of the run is at least 1 TPS below the first
Rising MSPTUp 25 percent and 2 ms
Growing server heapThe lowest reading of the last quarter is 15 percent and 32 MB above the lowest of the first
Growing tool heapThe same rule, for the tool itself

The heap rules compare the lowest readings because a Java heap goes up and down like a saw; only its floor shows a leak. The report is rewritten every 5 minutes during the run, so a crash at hour three still leaves three hours of data. See Soak Runs.

Reading the results

  • MSPT climbs with the bot count but stays under 50. You have headroom. The last count you tested is a number you can trust; anything above it is a guess.
  • MSPT passes 50 at some count. Open the spark profile from that run and sort by plugin. One plugin taking most of the tick is the usual picture. Find what lags your server with spark walks through reading the report.
  • Menu p95 is high while MSPT is fine. The menu itself is slow, often a database call or a large item build when it opens.
  • Join success under 100 percent. Look at the kick reasons in the report and the server log; a connection throttle or anti-bot plugin is the common cause on a test copy.
  • A trend is flagged in the soak run. Run it again with the same seed after a fix. The same choices on both runs make the comparison mean something.

What a bot test does not tell you

Bots do not render, run client mods or send what a modded client sends. They join from one machine, so network limits between real players and your host are not part of the test. And a test copy on different hardware gives different numbers: test on the machine you will run, or treat the result as a comparison, not a capacity.

Getting IgniteTestTool

The window runs on Windows 10 or 11 with JDK 21; on Linux the bots, the API and CI mode run headless. Bots speak to Paper servers from 1.21.4 to 1.21.11. Plans and prices are on the product page. If what you need is a test that fails a build when a menu breaks rather than a load test, read Test a Paper plugin with real bots.

Where to go next

Written from

  1. IgniteTestTool wiki: Load Runs and spark reports
  2. IgniteTestTool wiki: Soak Runs
  3. IgniteTestTool wiki: Bots and server versions