Is there a way to reduce RAM usage of the factorio server?
I tested loading my save with 2GB (ram) server and it wouldn't load the save (OS would kill it due to attempting to use too much ram). I also tested with 4GB server and it ran smoothly the factorio headless with my save (htop showed around 3.5GB usage for factorio), for a while until it kinda crashed the server (didn't have any swap memory as backup memory so couldn't recover):
Code: Select all
$ ls -bash: fork: Cannot allocate memory
My save isn't that huge yet, 244 rocket launches, filesize 41MB.
Obviously I could just upgrade to 6+ GB ram server.
Edit: Out of mem again, this time ran it in screen instaed of as daemon so I could send SIGINT to recover. Also uploaded the save to google drive. Let me know if the memory usage is totally normal in this case and I just should either run shorter games or upgrade the server to keep playing. Also I am interested in specific game settings (like disabling biters) that could significantly reduce the ram footprint of the game.
I guess autosaving (non-blocking) and logging silently fails when not enough memory available, following snippet is from screen-window. Kinda just describes what happens when too low ram for the application.
Code: Select all
2381.006 Verbose ServerSynchronizer.cpp:801: Peer 1 decreasing latency from 9 to 8 as buffer was always bigger than 2 2387.129 Verbose ServerRouter.cpp:158: Sending keepalive nat punch request to pingpong server. 2389.660 Info HttpSharedState.cpp:54: Downloading https://multiplayer.factorio.com/post-game-heartbeat/5744880 2404.581 Verbose ServerRouter.cpp:158: Sending keepalive nat punch request to pingpong server. 2409.973 Verbose ServerSynchronizer.cpp:814: Peer 1 increasing latency from 8 to 9 as it has skipped tick closures and empty buffer in the last period 2410.033 Verbose ServerSynchronizer.cpp:378: Peer 1 sent IncreasedLatencyConfirm tick: 9827405 increasedBy: 1 2419.680 Info HttpSharedState.cpp:54: Downloading https://multiplayer.factorio.com/post-game-heartbeat/5744880 2421.981 Info AppManager.cpp:267: Saving to _autosave43 (non-blocking). 2422.038 Info AsyncScenarioSaver.cpp:144: Saving process PID: 2929 2422.039  Verbose Scenario.cpp:834: Saving game as /opt/factorio/0.17.62/servers/public/saves/_autosave43 2422.887 Verbose ServerRouter.cpp:158: Sending keepalive nat punch request to pingpong server. 2503.519 Info HttpSharedState.cpp:54: Downloading https://multiplayer.factorio.com/post-game-heartbeat/5744880 ^C2529.748  Received SIGINT, shutting down 2529.748 Received SIGINT, shutting down 2549.264 Error HttpSharedState.cpp:136: CURL failed: code:28, 1c; Timeout was reached 2549.426 Info HttpSharedState.cpp:145: Downloading https://multiplayer.factorio.com/post-game-heartbeat/5744880 2549.686 Info HttpSharedState.cpp:146: Status code: 0 2550.693 Info MatchingServer.cpp:170: Failed to sendHeartbeat to the multiplayer matching server: Download failed (status code 520): failed to parse JSON response: Unexpected character (T) at ?:1 JSON: Timeout was reached 2551.845 Verbose MatchingServer.cpp:98: Sending update request for game(5744880) to matching server 2553.429 Info HttpSharedState.cpp:54: Downloading https://multiplayer.factorio.com/update-game/5744880 ^C2606.167  Received second SIGINT, terminating immediately 2606.167 Received second SIGINT, terminating immediately Server closed: /opt/factorio/0.17.62/servers/old_public