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

Filebeat - Support using O_DIRECT when reading files #3501

Closed
andrewkroh opened this issue Jan 31, 2017 · 6 comments
Closed

Filebeat - Support using O_DIRECT when reading files #3501

andrewkroh opened this issue Jan 31, 2017 · 6 comments
Labels
enhancement Filebeat Filebeat needs_team Indicates that the issue/PR needs a Team:* label Stalled

Comments

@andrewkroh
Copy link
Member

When reading files over NFS it would be useful to be able to use the O_DIRECT flag when opening the file for reading due to file cache coherency issues that can occur. Ideally this would be a config option that can be specified for a specific prospector/harvester. The config option would be supported only on platforms where we have the ability to use the O_DIRECT flag.

From: http://nfs.sourceforge.net/#section_a

If you need absolute cache coherency among clients, applications can use file locking, where a client purges file data when a file is locked, and flushes changes back to the server before unlocking a file; or applications can open their files with the O_DIRECT flag to disable data caching entirely.

From: https://access.redhat.com/solutions/22717

. . . when the size of the file increases on the NFS server after the NFS client has sent an asynchronous read request that reaches the EOF we see this issue.

Once the file size increases, the NFS client assumes that the previous read reply contains the data from the new region between the previous file size and the new file size.

Inside the NFS client, this region contains NULLs because the NFS client has never asked for nor received data for this region from the NFS server.

Other References

@ruflin
Copy link
Member

ruflin commented Feb 1, 2017

+1 on this and using a config option for it. Someone even create a "library" around this: https://github.com/ncw/directio But we should definitively have our own implementation.

@shelomentsevd
Copy link

Hi!
I want to try to add this option to filebeats, but there is a problem:
In https://github.com/ncw/directio implemented only Unix, Darwin and Windows OS's.
Not sure if it right to implement direct_o only for them, I suppose beats works on many systems not only darwin,windows and unix-like.
I'll be glad if somebody tells me which systems I should take in account.

@andrewkroh
Copy link
Member Author

I'd say that library would be fine to use. It says

This is library for the Go language to enable use of Direct IO under all supported OSes of Go (except openbsd and plan9).

Filebeat is used by people on openbsd so I'd take care to make the O_DIRECT config option not available on that system.

@shelomentsevd
Copy link

@andrewkroh I tried to exclude DIRECT_O on OpenBSD and Plan9 but I am not sure that did it right.
Can you please check my PR?

Thank you for your participation!

shelomentsevd added a commit to shelomentsevd/beats that referenced this issue Nov 16, 2018
@botelastic
Copy link

botelastic bot commented Jul 8, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@botelastic botelastic bot added Stalled needs_team Indicates that the issue/PR needs a Team:* label labels Jul 8, 2020
@botelastic
Copy link

botelastic bot commented Jul 8, 2020

This issue doesn't have a Team:<team> label.

@botelastic botelastic bot closed this as completed Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Filebeat Filebeat needs_team Indicates that the issue/PR needs a Team:* label Stalled
Projects
None yet
Development

No branches or pull requests

3 participants