Page 1 of 1

Factorio Dedicated Server Disk IO Patten?

Posted: Tue Apr 11, 2023 6:30 am
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.

Re: Factorio Dedicated Server Disk IO Patten?

Posted: Tue Apr 11, 2023 6:59 am
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?

Re: Factorio Dedicated Server Disk IO Patten?

Posted: Tue Apr 11, 2023 11:42 pm
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.

Re: Factorio Dedicated Server Disk IO Patten?

Posted: Wed Apr 12, 2023 5:57 am
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?