A
Admincraft•2y ago
revi

How much memory for 10 online users on a PaperMC server

Just trying to understand different approaches for answering this kind of questions.
40 Replies
revi
reviOP•2y ago
@ProGamingDK I've seen you answering this kind of questions a few times on #marketplace-legacy.
ProGamingDk
ProGamingDk•2y ago
there is no number 4-6 gb should work fine but it heavily depends
revi
reviOP•2y ago
Let's try to find something like a formula
ProGamingDk
ProGamingDk•2y ago
you cant. you physically cant make a formula for this
revi
reviOP•2y ago
10 online users on different parts of the map: - 6.9k loaded chunks - 2.4k active entities These are the objects filling up the memory, can be easily verified with a memory dump to understand if growing is linear. With PaperMC, memory ranges from ~3 GiB to ~5.5 GiB If you're lucky and some users are close, loaded chunks and active entities will go down. I'm always measuring with users on different parts of the map, because that's the worst case (more memory in use).
revi
reviOP•2y ago
No description
ProGamingDk
ProGamingDk•2y ago
with spikes of nearly 7gigs
revi
reviOP•2y ago
Let's ignore Dynmap, which is currently consuming ~1 GiB adding 8-10 more users we're getting linear increase in entities and chunks, so expecting a similar increase in used memory yeah 12k chunks, 4.65k entities and memory ranging from 5.25 to 8 GiB I was expecting a bit less, like 6 GB max for 20 users, but we may be using numbers from previous versions to do these calculations Shockbyte for example says you can use 1 GB for 8+ users, which is completely stupid.
ProGamingDk
ProGamingDk•2y ago
shockbyte is wrong on every step of the way either way have u seen their tos
revi
reviOP•2y ago
yeah but other popular providers aren't far from these numbers
ProGamingDk
ProGamingDk•2y ago
issue is these numbers just dont work on higher player counts 160+ player servers work fine with 16 gb with usage being around 12
revi
reviOP•2y ago
would be interesting to collect more about active entities, loaded chunks when that happens, and their related configs I'd expect a trend change when hitting ~12 GB of memory usage mostly because of JVM pauses, but we could find a more or less general formula that will work for < 9-12 GiB use cases but this is just memory, servers with 100+ users will probably hit longer ticks first (due to single CPU constraints) If people find this interesting, I'll try to also measure the impact of adding common plugins. Some of them require an almost fixed amount of memory, regardless of users. Others scale with the size of the map, and others with number of users. Others are virtually free in terms of memory.
Discount Milk
Discount Milk•2y ago
There is no magic number that correlates between memory usage and player count. What the players are doing and what the server is doing means far more to memory usage than the player count itself.
revi
reviOP•2y ago
the server can always have a huge farm with thousands of entities, slowing everything down and making frequent memory changes. but thinking about entities and chunks will give you a good estimate, as that's what causes ~90% of the memory increase when more users join the server.
ProGamingDk
ProGamingDk•2y ago
chunks uses different amounts of ram tho same with entities
revi
reviOP•2y ago
and entities and chunks are closely related to player counts, as chunks aren't active if no one is there
ProGamingDk
ProGamingDk•2y ago
entities arent really 1 person could have a 200 villager hall
Discount Milk
Discount Milk•2y ago
But they won't be removed from memory until the JVM does garbage collection
ProGamingDk
ProGamingDk•2y ago
while another just lives peaceful base with everything lighted up
revi
reviOP•2y ago
but that happens regularly, you can ignore that for a quick capacity planning
Cozy Suppe
Cozy Suppe•2y ago
Paper Server with currently 7 Playerss online
No description
Discount Milk
Discount Milk•2y ago
And the JVM does garbage collection only when it needs to. It doesn't do it on a timer.
ProGamingDk
ProGamingDk•2y ago
that one shows very random info its not very accurate in my experience
Discount Milk
Discount Milk•2y ago
So if you have a higher memory amount, you'll have more infrequent but larger memory fluctuations.
revi
reviOP•2y ago
you can tune your GC configs or even use a different GC implementation, but I'm trying to find something that works for 90% of use cases.
ProGamingDk
ProGamingDk•2y ago
basically everyone uses aikar flags
revi
reviOP•2y ago
that's what happens with servers over 9-12 GiB, when GC hits you hard and may need to tune your flags based on really custom needs if you like a different approach, let's find how much memory is consumed per chunk or entity and then multiply hopefully these are regular in size 🤞
ProGamingDk
ProGamingDk•2y ago
they arent not even really that close especially for villagers
revi
reviOP•2y ago
bigger in memory?
ProGamingDk
ProGamingDk•2y ago
well yeah it has to store all trades etc atleast thats what im thinking
revi
reviOP•2y ago
loaded chunks are for sure more than 53% of the heap, but these are represented by different classes from net.minecraft.world.level.chunk and io.papermc.paper.chunk (and probably others) so I'll need to identify these classes or packages more precisely before measuring how much memory they're using
Discount Milk
Discount Milk•2y ago
Yes that is the world data itself. It doesn't get unloaded from memory until it needs to
revi
reviOP•2y ago
if I'm not mistaken, entities are tiny in memory. A high number may cause TPS drops, but they don't require any significant amount compared to chunks.
Discount Milk
Discount Milk•2y ago
Correct, memory usage is mostly just world data. Then whatever data plugins need.
revi
reviOP•2y ago
that's good! it simplifies memory calculations
Discount Milk
Discount Milk•2y ago
Well you'd have to account for players that are next to other players, players that aren't next to other players, and what each plugin is doing.
revi
reviOP•2y ago
a ~7% of my heap is filled with Dynmap stuff 🫠
Discount Milk
Discount Milk•2y ago
Yeah sounds about right :KEKW:
revi
reviOP•2y ago
close to 1 GiB in Varoke we install Dynmap automatically, including TLS termination and custom subdomain, but we may need to find a more efficient alternative ~61% are chunks, ~3.5% are entities
Discount Milk
Discount Milk•2y ago
I'd argue that sounds right

Did you find this page helpful?