Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when set nr_files and openfiles simultaneously, performance will decrease significantly #1671

Open
1 task done
zqs-Oppenauer opened this issue Nov 17, 2023 · 3 comments
Open
1 task done

Comments

@zqs-Oppenauer
Copy link
Contributor

Please acknowledge the following before creating a ticket

Description of the bug:
I have simultaneously set the openfiles and nr_files parameters. Compared to only setting nr_files, I noticed a significant performance decline. Additionally, I found that this situation only occurs when nr_files is greater than twice the value of openfiles.

Environment: Debian GNU/Linux 10
fio version: fio-3.35

Reproduction steps
I use libaio engine and set nr_files = 2 firstly,

[global]
ioengine=libaio
direct=1

[job]
name=sync_test
iodepth=32
filesize=4G
rw=write
bs=4k
nr_files=2
numjobs=1
directory=/data00/fio/
截屏2023-11-18 00 05 11

then, I set nr_files=4 and openfiles=2, the performance decreases significantly

[global]
ioengine=libaio
direct=1

[job]
name=sync_test
iodepth=32
filesize=4G
rw=write
bs=4k
nrfiles=4
openfiles=2
numjobs=1
directory=/data00/fio/

the result as below.

截屏2023-11-18 00 11 32

I notice that the main difference is IO depths in fio report. In the second fio test, one half of IO depths is 1 or 2, but in the first fio test, the IO depths is almost 32.

@vincentkfu
Copy link
Collaborator

When you limit the number of files open at one time with openfiles fio has to do additional work to close and re-open files. So it's not surprising that performance is worse.

Note that you have an identification problem in your comparison above. We can't tell if the performance difference is due to nrfiles or openfiles because between the two jobs you alter both variables. In order to have better evidence of an effect due to openfiles you should set nrfiles in both jobs to 4.

@zqs-Oppenauer
Copy link
Contributor Author

thanks for your reply!
I set nrfiles to 4 in both jobs and test again, it seems that the performance is also worse.

  • the first job, set nrfiles to 4 and openfiles to 2
[global]
ioengine=libaio
direct=1

[job]
name=sync_test
iodepth=32
filesize=4G
rw=write
bs=4k
nr_files=4
openfiles=2
numjobs=1
directory=/data00/fio/

the result as below
截屏2023-11-22 01 32 38

  • the second job, only set nrfiles to 4
[global]
ioengine=libaio
direct=1

[job]
name=sync_test
iodepth=32
filesize=4G
rw=write
bs=4k
nr_files=4
numjobs=1
directory=/data00/fio/

the result as below
截屏2023-11-22 01 33 53

I notice that when set openfiles to 2, bw is always worse, I think the additional work to close and re-open files may not always influence fio job?

@vincentkfu
Copy link
Collaborator

You can also try running with --debug=file and compare the output between the two jobs to gain some insight into what is happening. Try making the job as small as possible as this may produce a lot of output. You may also wish to try --debug=file,io.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants