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

DAOS-13216 dfuse: Add a pre-read feature for non-cached files. #12015

Merged
merged 45 commits into from
Oct 7, 2023

Conversation

ashleypittman
Copy link
Contributor

When the kernel cache is in use but a file is not cached
then pre-read the file on open.

Required-githooks: true

Signed-off-by: Ashley Pittman ashley.m.pittman@intel.com

@github-actions
Copy link

github-actions bot commented Apr 21, 2023

Bug-tracker data:
Ticket title is 'file read-ahead in dfuse.'
Status is 'In Review'
Labels: 'triaged'
https://daosio.atlassian.net/browse/DAOS-13216

Copy link
Collaborator

@daosbuild1 daosbuild1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/client/dfuse/ops/read.c Outdated Show resolved Hide resolved
@daosbuild1
Copy link
Collaborator

@daosbuild1
Copy link
Collaborator

Test stage Build RPM on Leap 15.4 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12015/1/execution/node/307/log

@daosbuild1
Copy link
Collaborator

Test stage Build RPM on EL 8 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12015/1/execution/node/310/log

@daosbuild1
Copy link
Collaborator

Test stage Build DEB on Ubuntu 20.04 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12015/1/execution/node/369/log

Copy link
Collaborator

@daosbuild1 daosbuild1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. No errors found by checkpatch.

@daosbuild1
Copy link
Collaborator

Test stage Build RPM on Leap 15.4 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12015/2/execution/node/333/log

@daosbuild1
Copy link
Collaborator

Test stage Build RPM on EL 8 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12015/2/execution/node/330/log

@daosbuild1
Copy link
Collaborator

Test stage Build DEB on Ubuntu 20.04 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12015/2/execution/node/280/log

When the kernel cache is in use but a file is not cached
then pre-read the file on open.


Signed-off-by: Ashley Pittman <ashley.m.pittman@intel.com>
# ------------------------ >8 ------------------------
Skip-func-hw-test: true
Skip-func-test: true
Quick-Functional: true
Test-tag: dfuse
Test-tag: dfuse

Required-githooks: true

Signed-off-by: Ashley Pittman <ashley.m.pittman@intel.com>
Copy link
Collaborator

@daosbuild1 daosbuild1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. No errors found by checkpatch.

Test-tag: dfuse
Required-githooks: true
Signed-off-by: Ashley Pittman <ashley.m.pittman@intel.com>
Copy link
Collaborator

@daosbuild1 daosbuild1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. No errors found by checkpatch.

Test-tag: dfuse
Required-githooks: true
Signed-off-by: Ashley Pittman <ashley.m.pittman@intel.com>
@ashleypittman ashleypittman changed the title DAOS-0000 dfuse: Add a pre-read feature for non-cached files. DAOS-13216 dfuse: Add a pre-read feature for non-cached files. Apr 24, 2023
@daosbuild1
Copy link
Collaborator

Test stage Functional on EL 8 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12015/4/execution/node/1015/log

Test-tag: dfuse
Required-githooks: true
Signed-off-by: Ashley Pittman <ashley.m.pittman@intel.com>
Copy link
Collaborator

@daosbuild1 daosbuild1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. No errors found by checkpatch.

Test-tag: dfuse
Required-githooks: true
Signed-off-by: Ashley Pittman <ashley.m.pittman@intel.com>
Copy link
Collaborator

@daosbuild1 daosbuild1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. No errors found by checkpatch.

@daosbuild1
Copy link
Collaborator

Test stage Build on Leap 15.4 with Intel-C and TARGET_PREFIX completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12015/6/execution/node/345/log

@daosbuild1
Copy link
Collaborator

@daosbuild1
Copy link
Collaborator

Test stage Build RPM on EL 8 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12015/6/execution/node/366/log

@daosbuild1
Copy link
Collaborator

Test stage Build RPM on Leap 15.4 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12015/6/execution/node/353/log

Test-tag: dfuse
Required-githooks: true
Signed-off-by: Ashley Pittman <ashley.m.pittman@intel.com>
@daosbuild1
Copy link
Collaborator

Test stage Functional Hardware Medium Verbs Provider completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12015/37/execution/node/1258/log

Copy link
Collaborator

@daosbuild1 daosbuild1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. No errors found by checkpatch.

@mchaarawi
Copy link
Contributor

have not dug into the code yet in this PR and have just some high level questions based on the comment of pre-read you added:

  • if we are doing this ls -R or recursive readdir like resnet does initially from every thread before reading any data, are we going to trigger this pre-read? (that would be disastrous). i don't think the file is opened in this case, but not sure.
  • in the case of a pre-read during the open, do we read 1 mib or up to the size of the file? is this querying the file size, or does fuse or dfuse already have queried the file size before issuing the open?
  • is there a practical application this is aimed for?

@ashleypittman
Copy link
Contributor Author

have not dug into the code yet in this PR and have just some high level questions based on the comment of pre-read you added:

  • if we are doing this ls -R or recursive readdir like resnet does initially from every thread before reading any data, are we going to trigger this pre-read? (that would be disastrous). i don't think the file is opened in this case, but not sure.

ls -R will not call open so no, there would be no difference to that code path.

  • in the case of a pre-read during the open, do we read 1 mib or up to the size of the file? is this querying the file size, or does fuse or dfuse already have queried the file size before issuing the open?

The file size is known during open and returned to the kernel. This is then used for the read size. The open performance should be unaffected (and there's no I/O changes during open).

  • is there a practical application this is aimed for?

This was tested with the Resnet training stage and helped, it should be useful for any dataset ingest which is dominated by read of smaller files.

mchaarawi
mchaarawi previously approved these changes Sep 22, 2023
Copy link
Contributor

@mchaarawi mchaarawi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me. im not clear though what happens in the case if the file was written to after the pre-read happens. Is the pre-read buffer dropped?

Features: dfuse

Required-githooks: true
Copy link
Collaborator

@daosbuild1 daosbuild1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. No errors found by checkpatch.

@daosbuild1
Copy link
Collaborator

Test stage Functional Hardware Medium Verbs Provider completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12015/39/execution/node/1292/log

Copy link
Collaborator

@daosbuild1 daosbuild1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. No errors found by checkpatch.

@ashleypittman
Copy link
Contributor Author

looks good to me. im not clear though what happens in the case if the file was written to after the pre-read happens. Is the pre-read buffer dropped?

If the pre-read buffer is used then once it's exhausted (which might take several reads depending on application I/O sizes) then it will be released. If there is other I/O, either writes or reads from elsewhere in the file then the buffer will not be used, but it won't be released until close.

Comment on lines +69 to +70
if (oh->doh_linear_read_pos != position) {
DFUSE_TRA_DEBUG(oh, "disabling readahead");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So "linear read" is synonymous with "readahead"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently yes. This PR started are read-ahead after the first read before I realised that the speculative read could happen on open. This is debugging so I think it's Ok though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking from the perspective of the variable names, etc., but not asking you to change this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/daos-stack/daos/blob/master/src/client/dfuse/dfuse.h#L117-L126

linear read means the file was opened, read from start to end without seeking and closed. We already track this to short-circuit the last zero-length read so we use that data to know if to use the pre-read buffer.

@daosbuild1
Copy link
Collaborator

Test stage Functional Hardware Medium Verbs Provider completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12015/40/execution/node/1268/log

@daosbuild1
Copy link
Collaborator

Test stage Functional Hardware Medium completed with status UNSTABLE. https://build.hpdd.intel.com/job/daos-stack/job/daos//view/change-requests/job/PR-12015/40/testReport/

@daosbuild1
Copy link
Collaborator

Test stage Functional Hardware Large completed with status FAILURE. https://build.hpdd.intel.com/job/daos-stack/job/daos/job/PR-12015/40/display/redirect

Copy link
Collaborator

@daosbuild1 daosbuild1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. No errors found by checkpatch.

@daosbuild1
Copy link
Collaborator

Test stage Functional Hardware Medium Verbs Provider completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12015/41/execution/node/1267/log

Copy link
Collaborator

@daosbuild1 daosbuild1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. No errors found by checkpatch.

@ashleypittman ashleypittman merged commit 875e233 into master Oct 7, 2023
32 of 34 checks passed
@ashleypittman ashleypittman deleted the amd/pre-read branch October 7, 2023 07:34
jolivier23 pushed a commit that referenced this pull request Oct 10, 2023
When the kernel cache is in use but a file is not cached
then pre-read the file on open.

This works for files up to the read buffer size (1Mb) and is
enabled based on the I/O pattern of the last file closed in the
same directory.

Required-githooks: true

Signed-off-by: Ashley Pittman <ashley.m.pittman@intel.com>
Signed-off-by: Jeff Olivier <jeffolivier@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants