Paper is a high-performance fork of Spigot that adds extra features while also increasing server performance. You can find more information about it here.
Paper also tends to fix bugs that come out after initial releases of Spigot for the latest versions of Minecraft. A good example would be the 0-tick farm bug that existed for a long time, and for the people who didn't want 0-tick farms in specific to be patched, they added it as an option in the paper.yml config!
Paper has better API support for plugin developers, which means it has more support for plugin creators and more features that can be utilized in their plugins.
Another reason to get Paper is thanks to their asynchronous chunk loading and generation. This means fast traveling methods won't lag your server as hard and chunk loading becomes much faster in general!
2. Customize your server configurations
Now we will start with getting the server optimized manually. It's relatively easy to learn!
We will start by configuring server.properties - Keep in mind that this guide only covers certain options, it's encouraged to take a look at everything and customize it to your liking!
There are a lot of settings here, but we will only focus on the ones that matter the most for what type of server you plan on running.
view-distance is how far chunks will be loaded by players in your server. You will want this between 4 and 16, in multiples of two (I.E. 4, 6, 8, 10, 12, 14, 16). Too little and you won't be to see very far, too much and the server will have performance issues. This generally depends on how many players you plan on having in your server, and how much RAM you have.
View distances 12 - 16 would be best for around one to five players. Like a small group of friends, or a very small server.
View distances 8 - 10 are generally best for average sized servers (around ten or more players), although view-distance is set to 8 by default. It's usually best to keep view-distance set to 8.
View distances 4 and 6 are best for very small worlds, like minigames. This way you can have a lot of players in the same general area, without taking up too many server resources.
level-seed is what you'll want to set when using a custom seed for your server's world, keep in mind that you'll need to generate a new world in order for this setting to work.
motd is the text that shows up for your server in the in-game server list. You can make a custom MOTD with colors and formatting here.
difficulty can be set to peaceful, easy, normal, or hard. Keep in mind that hard is best if you plan on having villager farms, as any other difficulty gives a chance for villagers to permanently die, rather than be converted into zombie villagers.
max-players can be set to anything, like 9001, or 1337, or simply 100. This option is up to you, although it's best to set it according to how many players you expect to have.
Most stuff in spigot.yml are things you won't want to touch, but a few things that are useful are what's listed below.
Listed here is a page explaining most of everything in spigot.yml
There are a few interesting things you can change, a few of them being:
merge-radius is the amount of space before dropped items (blocks, mob drops, etc.) will merge. Set these to 0.0 for a classic back-in-the-day Minecraft feel!
growth contains settings for growth modifiers for many different types of crops, you can change these individually to whatever values you like!
ticks-per and hopper-amount are great if your server contains mass autofarms with thousands of hoppers, boosting hopper speed and/or amount can help reduce the amount of lag your server gets. There is no need to change this if your server doesn't have these, but the effect is definitely noticeable.
There are a lot of useful settings in here, feel free to check them out for yourself! Also make sure to customize plugins to your liking, as having everything utilized makes a server shine!
3. Lag management
If your server starts to lag, take a look at your plugins, make sure none of them are known to cause issues or have incompatibilities with your current version. Another very useful feature of Paper is timings. Doing /timings report in-game will generate a report that tells you what may be causing unneeded TPS (ticks-per-second) usage on your server. 20 TPS is perfect, 0 lag on your server. Anything less than that means something may be causing lag.
Also, contrary to popular belief, most "Clear Lag" plugins will not actually reduce lag by getting rid of dropped items. It's up to server owners to optimize and properly manage their server for lag not to happen. Dropped items generally do not cause TPS lag, but rather FPS (framerate) lag if there's too many of them.
Good examples of things that cause TPS lag are players loading new chunks, players traveling fast (elytra, boosted minecart, flying, etc.) mass autofarms, lag machines, noise machines, condensed mob farms, egg farms with too many chickens (too many mobs in one space, leading to TPS lag due to mob collisions and the chickens trying to pathfind), and things with many moving parts involving pistons, like large flying machines.
Bad examples of things that actually don't cause TPS lag but may be confused for it are things like many dropped items on the ground causing loss in framerate, minecarts, armor stands, and item frames causing framrate lag due to the amount of entities being rendered, fishing bobbers and boats, which some "lag clearing" plugins remove for some reason, arrows, and other things like that.