Files.touch causes unnecessary disk contention
See original GitHub issueWhen calling Files.touch(foo)
on a file that already exists, Guava will call java.io.File#createNewFile()
and assume the file already exists if the creation operation fails. But because Java guarantees the existence check and creation are atomic, the existence check lives inside a call to java.io.FileSystem#createFileExclusively
, introducing concurrency penalties that might not be needed.
Instead, Guava should skip file.createNewFile()
when file.exists()
returns true.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Is There Disk Contention? (Sun GlassFish Enterprise Server ...
A disk contention can have a negative impact on user data read/writes to the disk devices, as well as on HADB writing to...
Read more >Disk IO Rate: What causes it and what does it mean to me?
... IO: anything that touches the disk (either reads or writes) is considered IO. Page views will surely cause IO from writing log...
Read more >Different I/O Access Methods for Linux, What We Chose for ...
Explore the four different ways to perform disk I/O on Linux and the tradeoffs and what we chose for ScyllaDB to build a...
Read more >Fixing Disk Latency and I/O Congestion to Improve Slow ...
The Windows file system is notorious for creating lots of small I/O, which increases SCSI traffic across the storage stack, clogs queues and...
Read more >How to test drive Amazon Elastic File System
Inode contention occurs when multiple threads are attempting to update the same inode, which can be more evident in network file systems due...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
(Should we just be doing what we do in
MoreFiles.touch
(taking into account that theFile
API returnsfalse
instead of throwing)?)Sorry, I thought I had seen
O_EXCL
on thetouch
strace
output, but you’re right. Thanks for all the info. I’m still not sure if we’ll end up doing something about this, but now I understand better.