Factorio Dedicated Server Disk IO Patten?

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
User avatar
hanyuwei70
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sun Mar 04, 2018 9:35 am
Contact:

Factorio Dedicated Server Disk IO Patten?

Post by hanyuwei70 »

Hi, I am a server admin for factorio server.
Recently I found that Factorio DS are quite strange in saving saves. It take **much** longer on cloud server (aliyun) rather than bare mental machines.
After investigating, Factorio DS seems like using fsync syscall to ensure saves are written to disk (which is good).
What stranges me most is cloud server's monitor table shows disk IOPS and throughput is little used. And I can't figure out why.
So is there any advice about this?

P.S.
I wish I could have a button to enable non fsync syscall to save the save.

EDIT: I have async save off.
Last edited by hanyuwei70 on Wed Apr 12, 2023 5:57 am, edited 1 time in total.

User avatar
hanyuwei70
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sun Mar 04, 2018 9:35 am
Contact:

Re: Factorio Dedicated Server Disk IO Patten?

Post by hanyuwei70 »

I found something interesting.
on cloud server, my disk works like this

Code: Select all

# dd if=/dev/zero of=test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 8.65808 s, 124 MB/s
# dd if=/dev/zero of=test2.img bs=512 count=1000 oflag=dsync
1000+0 records in
1000+0 records out
512000 bytes (512 kB, 500 KiB) copied, 1.1676 s, 439 kB/s
on my bare mental server

Code: Select all

%dd if=/dev/zero of=test2.img bs=512 count=1000 oflag=dsync
1000+0 records in
1000+0 records out
512000 bytes (512 kB, 500 KiB) copied, 0.194241 s, 2.6 MB/s
%dd if=/dev/zero of=test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 4.87952 s, 220 MB/s
seems like disk io latency played a important role in saving speed.
could devs optimize these?

mrvn
Smart Inserter
Smart Inserter
Posts: 5795
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Factorio Dedicated Server Disk IO Patten?

Post by mrvn »

First: Do you have async save on or off in the config? Did you try both?

Secondly you should look what IO Pattern the saving actually takes before assuming latency is an issue at all. Doing an fsync() after a 1GB save file once and adding 1s of latency to that will hardly matter.

User avatar
hanyuwei70
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sun Mar 04, 2018 9:35 am
Contact:

Re: Factorio Dedicated Server Disk IO Patten?

Post by hanyuwei70 »

mrvn wrote:
Tue Apr 11, 2023 11:42 pm
First: Do you have async save on or off in the config? Did you try both?

Secondly you should look what IO Pattern the saving actually takes before assuming latency is an issue at all. Doing an fsync() after a 1GB save file once and adding 1s of latency to that will hardly matter.
I have async save off due to experimental.

How to deliberately add latency to disk IO in Linux? using qemu?

Post Reply

Return to “Technical Help”