Repository navigation
Size the server for the 2 vCPU / 4 GB box - #73
Closed
OpenSource-For-Freedom wants to merge 1 commit into
Closed
OpenSource-For-Freedom wants to merge 1 commit into
OpenSource-For-Freedom wants to merge 1 commit into
Conversation
Downsizing to cut the bill from $48 to $24. The pinned limits here were sized
for 4 vCPU / 8 GB and three of them break on the smaller plan, one of them
fatally:
cpus was 3.5. Docker REFUSES to create a container whose cpus exceeds the host
core count ("Range of CPUs is from 0.01 to 2.00, as there are only 2 CPUs
available"), so on a 2 vCPU box this is not a performance question. compose up
fails, the health check fails, and deploy.sh rolls back to a revision carrying
the same bad value, leaving the server down until someone edits this line. Now
1.75: the same 87.5% share of the box that 3.5-of-4 was, keeping the headroom
for sshd, tailscaled, auditd and the deploy timer that the old comment here
argued for.
mem_limit 6.5g and a 5G heap exceed the whole 4 GB host, so the kernel
OOM-killer would take the server down under load. Now a 3.2g cap with a 2G
heap, keeping about 1.2g for the JVM's non-heap needs and 800Mi for the host.
These numbers are deliberately also safe on an 8 GB host, just wasteful there:
a limit that fits the small plan cannot break the big one, while a limit sized
for the big plan takes the small one down outright.
MAX_PLAYERS goes 20 to 5. 20 was typed, never measured and never tested. A
slot only costs memory while someone is in it, but the worst case is what has
to fit, and on 4 GB it does not. Five is the real population.
VIEW_DISTANCE 12 to 8 and SIMULATION_DISTANCE 8 to 6. Loaded chunks scale with
the square of view distance, so this is about 56% fewer chunks held per player
and the biggest lever on heap and tick time that costs no content. Simulation
6 still exceeds the 4-chunk radius that keeps a player's own farms and Create
contraptions ticking.
Be honest about the heap: 2G is under-provisioned for roughly 30 mods
including Create, CC:Tweaked, BlueMap, Terralith, When Dungeons Arise and Ad
Astra's five extra dimensions. It ran on 5G. Expect GC pressure. spark is in
the mod list now, so this is measurable rather than guesswork, and the first
cut if it will not hold is BlueMap: its port is bound to 127.0.0.1 and
reachable only through an SSH tunnel, so no player can see what it spends
memory rendering. Cutting mods that place blocks (Ad Astra, Create) is not an
option, because removing them deletes what players built with them.
Owner
Author
|
Not needed: staying on s-4vcpu-8gb at $48. Keeping 4 vCPU means keeping 8 GB (DigitalOcean does not sell 4 vCPU with less, and the premium 4 vCPU / 4 GB plans are $62 to $67, more than the current bill), and the 160 GB disk cannot be shrunk in place so it is not a saving either. Merging this would cut the heap to 2G and view distance to 8 on a box with 8 GB, which is strictly worse. The player cap and chunk tuning move to a separate PR sized for the hardware we are actually keeping. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Downsizing the droplet to cut the bill. Three pinned limits were sized for
4 vCPU / 8 GB and break on a smaller plan, one of them fatally.
cpus: 3.5is the fatal one. Docker refuses to create a container whose cpusexceeds the host core count ("Range of CPUs is from 0.01 to 2.00, as there are
only 2 CPUs available"). On a 2 vCPU box
compose upfails, the health checkfails, and
deploy.shrolls back to a revision carrying the same bad value, sothe server stays down until someone edits the file. The rollback cannot save it.
mem_limit: 6.5gand a 5G heap exceed a 4 GB host outright, so the kernelOOM-killer takes the server down under load.
What
cpusmem_limitmem_reservationINIT_MEMORY/MAX_MEMORYMAX_PLAYERSVIEW_DISTANCESIMULATION_DISTANCESized for the small box on purpose, and safe on an 8 GB host too, just
wasteful there: a limit that fits the small plan cannot break the big one,
while a limit sized for the big plan takes the small one down outright.
The honest part
2G heap is under-provisioned for roughly 30 mods including Create, CC:Tweaked,
BlueMap, Terralith, When Dungeons Arise and Ad Astra's five extra dimensions.
It ran on 5G before. Expect GC pressure, and measure rather than guess: spark
is in the mod list now, which is what issue #75 was waiting for.
If it will not hold, the first cut is BlueMap. Its port is bound to 127.0.0.1
and reachable only through an SSH tunnel, so no player can see what it spends
memory rendering. Cutting mods that place blocks (Ad Astra, Create) is not an
option: removing them deletes what players built with them.
Validation
docker compose configvalidates. test_world_no_player_data,test_client_server_mods, test_custom_mods_reviewed, test_kubejs_script_hazards,
test_security_alerts and test_design_role.js all pass. The only test touching
these values asserts
mem_limit:is present, which it still is.Touches no
data/world/path, so it cannot affect the live save.