Skip to content

Commit c230a28

Browse files
zlataovcekashike
andauthored
feat: profiling (spark) (#447)
* feat: profiling (Spark) * fix: rearrange * fix: address comments Co-authored-by: Riley Park <rileysebastianpark@gmail.com> * feat: `spark.enabled` configuration key * feat: `paper.preferSparkPlugin` property * refactor: no more system properties * feat: `plugins/spark` folder --------- Co-authored-by: Riley Park <rileysebastianpark@gmail.com>
1 parent c5127fa commit c230a28

File tree

4 files changed

+73
-0
lines changed

4 files changed

+73
-0
lines changed

config-specs/paper/paper-global.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,20 @@ spam-limiter:
355355
description: >-
356356
The number that the internal tab spam counter can reach until the server
357357
kicks the player for spam
358+
spark:
359+
enabled:
360+
default: "true"
361+
description: Whether the bundled spark profiler should be enabled.
362+
enable-immediately:
363+
default: "false"
364+
description: >-
365+
Whether the bundled spark profiler should be enabled as soon as possible. This can be useful for profiling the server during startup.
366+
By default, spark is enabled once the server has finished starting up (when the **Done (X.XXXs)! For help, type "help"** message is sent in the console).
367+
prefer-spark-plugin:
368+
default: "false"
369+
description: >-
370+
Whether the bundled spark profiler should be disabled in favor of a standalone plugin.
371+
If the spark plugin is not found, the bundled version will be loaded regardless of the setting, unless it is [explicitly disabled](#spark_enabled).
358372
timings:
359373
enabled:
360374
default: "false"

config/sidebar.paper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const paper: SidebarsConfig = {
3636
items: [
3737
"admin/how-to/basic-troubleshooting",
3838
"admin/how-to/update",
39+
"admin/how-to/profiling",
3940
"admin/how-to/aikars-flags",
4041
"admin/how-to/anti-xray",
4142
"admin/how-to/get-to-vanilla",
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
slug: /profiling
3+
description: How to profile your Paper server.
4+
---
5+
6+
# Profiling
7+
8+
Profiling is a way to diagnose performance problems with your server.
9+
A profiler measures certain characteristics of a running server, e.g. how often a method is called
10+
and how much time it takes up in a single tick, how long and often the garbage collector runs and much more.
11+
12+
:::warning
13+
14+
_For profiling to be effective, the issue you are diagnosing must be actively occurring._
15+
16+
:::
17+
18+
If you need help with analyzing a performance issue, please bring a spark report to the
19+
[PaperMC Discord server](https://discord.gg/PaperMC) (#paper-help) for assistance.
20+
21+
## spark
22+
23+
Starting with 1.21, Paper bundles the [spark](https://spark.lucko.me/) profiler, which is the preferred way
24+
to profile Paper.
25+
26+
To start profiling your server, run this command:
27+
```
28+
/spark profiler start --timeout 600
29+
```
30+
31+
After 10 minutes, this will return a URL to a profiler report, which you can analyze yourself or provide
32+
to a developer of a plugin or the Paper support chats.
33+
34+
This is only a fraction of what spark can do, so if you want to learn about the different features of spark
35+
or learn to analyze reports yourself, check out spark's documentation [here](https://spark.lucko.me/docs/).
36+
37+
:::tip
38+
39+
If you want to use a version of spark newer than the bundled one, simply place a standalone spark plugin JAR
40+
into the `plugins` directory and enable the [`spark.prefer-spark-plugin`](../reference/configuration/global-configuration.mdx#spark_prefer_spark_plugin)
41+
global configuration option.
42+
43+
:::
44+
45+
## Timings
46+
47+
Paper also bundles the [Timings v2](https://timings.aikar.co/) profiler, however Timings has been unmaintained
48+
for multiple years and its reports are difficult to read for beginners. It has been deprecated in favor of
49+
spark and turned off by default in 1.21, see [this discussion](https://github.com/PaperMC/Paper/discussions/10565)
50+
for more information.

src/components/config/ConfigurationStructureDiagram.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ const folderData: ExplorerNode[] = [
4848
url: "https://forums.papermc.io/threads/important-dev-psa-future-removal-of-cb-package-relocation.1106/",
4949
external: true,
5050
},
51+
{
52+
name: "spark",
53+
type: "folder",
54+
description:
55+
"Used to store configuration and data for the bundled spark profiler. (Learn more)",
56+
url: "https://spark.lucko.me/docs/Configuration",
57+
external: true,
58+
},
5159
],
5260
},
5361
{

0 commit comments

Comments
 (0)