question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Files.touch causes unnecessary disk contention

See original GitHub issue

When 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:open
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cpovirkcommented, Oct 5, 2019

(Should we just be doing what we do in MoreFiles.touch (taking into account that the File API returns false instead of throwing)?)

1reaction
cpovirkcommented, Oct 5, 2019

Sorry, I thought I had seen O_EXCL on the touch 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found