-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-17313. FileSystem.get to support slow-to-instantiate FS clients. #2396
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
HADOOP-17313. FileSystem.get to support slow-to-instantiate FS clients. #2396
Conversation
|
Looks good. Just the pending test. |
|
yeah, let me get that out the way before I forget about that cache. I'll use a counter of discarded instances and test off that. I'll plan some tricks to avoid the test being fussy about timing...have a semaphore inside the fake FS I'll be instantiating to block its construction, as sleep() is brittle as well as slowing down test runs |
|
Also, I plan to move the close in a discard out of the locked area. It's not needed and an FS is doing anything there, we don't want to block the other threads |
...p-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileSystemCaching.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just some small nits and checkstyles.
Have one doubt also: Is there particular reasoning for "64" as the default value?
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
Outdated
Show resolved
Hide resolved
...p-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileSystemCaching.java
Outdated
Show resolved
Hide resolved
|
No. I wondered whether to make it smaller or just leave large. Large: no visible impact of this change anywhere, so lowest risk I think I should add a mention of this in the s3a performance doc, so it's not forgotten about |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if close() throw IOException ?
Even it has cached object, it will not return that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is an interesting thought. I just left that code as is, but yes, it could fail
Looking at FileSystem.close, the removal of the entry from the cache should be in a finally clause too, shouldn't it. ouch. Ignoring that for now.
How about I go to IOUtils.close() & catch and log on failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at FileSystem.close, the removal of the entry from the cache should be in a finally clause too, shouldn't it. ouch. Ignoring that for now.
I feel not required, processDeleteOnExit() already catching the IOException.
How about I go to IOUtils.close() & catch and log on failures.
I didn't get this, are you planning to use IOUtils.close() to close filesystem instance ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel not required, processDeleteOnExit() already catching the IOException.
yes, but look at the subclasses
fa4b65d to
40f9e98
Compare
This comment has been minimized.
This comment has been minimized.
|
Don't get the test failure. Will rebase |
40f9e98 to
5c41240
Compare
This comment has been minimized.
This comment has been minimized.
Adds a semaphore to throttle the #of parallel clients which can be created simultaneously, set in "fs.creation.parallel.count". Change-Id: I794cecac4a23ae7e1aa376e16b4085ea5ae20086
* Move FileSystem.close() outside the semaphored block, so it does not hold up other threads. * Tests which use the count of discarded instances for their assertions. Change-Id: I4dfaf6f2a327142048438b1bfa4c4517e595df50
* Address Mehakmeet's comments * Checkstyles * And document in s3 performance file Change-Id: I9568f980f4e9917448a1d4d1c7c2d070a6f28bad
if, in FileSystem.get(), a superfluous instance is closed(), exceptions there are swallowed. Also: put the deregistration of the class from the cache into a finally block, so even if a subclass's processDeleteOnExit code raises any exception, the filesystem is removed from the cache Change-Id: I513215fe266bbad7a864481d0505cc9073a7c35a
5c41240 to
788a73b
Compare
This comment has been minimized.
This comment has been minimized.
|
@surendralilhore -could you look @ this again? Think I've tried to address your comments |
+1 |
|
thanks -merging to 3.3+! |
…s. (#2396) This adds a semaphore to throttle the number of FileSystem instances which can be created simultaneously, set in "fs.creation.parallel.count". This is designed to reduce the impact of many threads in an application calling FileSystem.get() on a filesystem which takes time to instantiate -for example to an object where HTTPS connections are set up during initialization. Many threads trying to do this may create spurious delays by conflicting for access to synchronized blocks, when simply limiting the parallelism diminishes the conflict, so speeds up all threads trying to access the store. The default value, 64, is larger than is likely to deliver any speedup -but it does mean that there should be no adverse effects from the change. If a service appears to be blocking on all threads initializing connections to abfs, s3a or store, try a smaller (possibly significantly smaller) value. Contributed by Steve Loughran. Change-Id: I57161b026f28349e339dc8b9d74f6567a62ce196
…te FS clients. (apache#2396) This adds a semaphore to throttle the number of FileSystem instances which can be created simultaneously, set in "fs.creation.parallel.count". This is designed to reduce the impact of many threads in an application calling FileSystem.get() on a filesystem which takes time to instantiate -for example to an object where HTTPS connections are set up during initialization. Many threads trying to do this may create spurious delays by conflicting for access to synchronized blocks, when simply limiting the parallelism diminishes the conflict, so speeds up all threads trying to access the store. The default value, 64, is larger than is likely to deliver any speedup -but it does mean that there should be no adverse effects from the change. If a service appears to be blocking on all threads initializing connections to abfs, s3a or store, try a smaller (possibly significantly smaller) value. Contributed by Steve Loughran. Change-Id: I57161b026f28349e339dc8b9d74f6567a62ce196
This adds a semaphore to throttle the number of FileSystem instances which
can be created simultaneously, set in "fs.creation.parallel.count".
This is designed to reduce the impact of many threads in an application calling
FileSystem.get() on a filesystem which takes time to instantiate -for example
to an object where HTTPS connections are set up during initialization.
Many threads trying to do this may create spurious delays by conflicting
for access to synchronized blocks, when simply limiting the parallelism
diminishes the conflict, so speeds up all threads trying to access
the store.
The default value, 64, is larger than is likely to deliver any speedup -but
it does mean that there should be no adverse effects from the change.
If a service appears to be blocking on all threads initializing connections to
abfs, s3a or store, try a smaller (possibly significantly smaller) value.
Contributed by Steve Loughran.