Manish
Manish

Reputation: 677

Is using java file io fine in multithreaded and high load scenario?

I have a scenario where for every request I need to open a file and read it . This file will be mostly small in size. There is a constraint that the node I am on doesnt have database . so data can be stored in files only. Will there be any issues when multiple requests execute parallely on same file ? Are there any alternatives? I am using java and doing file IO using java.

Upvotes: 1

Views: 77

Answers (1)

Thomas Kläger
Thomas Kläger

Reputation: 21435

File opening and closing doesn't necessarily lead to performance problems - an OS is usually rather good at it and can open / close thousands of files per second (especially if it is always the same file - the OS will cache it for you)

Upvotes: 1

Related Questions