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

[SPARK-29550][SQL] - enhance session catalog locking #26213

Conversation

choojoyq
Copy link

@choojoyq choojoyq commented Oct 22, 2019

What changes were proposed in this pull request?

In my streaming applicationspark.streaming.concurrentJobs is set to 50 which is used as size for underlying thread pool. I perform several sql operations on dataframes and automatically create/alter tables/view in runtime. I order to do that i invoke create ... if not exists operations on driver on each batch invocation. Once i noticed that most of batch time is spent on driver but not on executors. I made a thread dump and figured out that most of the threads are blocked on SessionCatalog operation waiting for a lock.

Existing implementation of SessionCatalog uses a single lock which is used almost by all the methods to guard currentDb and tempViews variables. I propose to enhance locking behaviour of SessionCatalog by :

  1. Employing ReadWriteLock which allows to execute read operations concurrently.
  2. Replace synchronized with the corresponding read or write lock.

Also it's possible to go even further and strip locks for currentDb and tempViews but i'm not sure whether it's possible from the implementation point of view.
Probably someone will help me with this?

How was this patch tested?

Only via existing test suits.

@choojoyq choojoyq force-pushed the SPARK-29550-enhance-session-catalog-locking branch from 2d3be32 to acef06a Compare October 22, 2019 15:13
@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@choojoyq choojoyq force-pushed the SPARK-29550-enhance-session-catalog-locking branch from acef06a to d6ba3e5 Compare October 22, 2019 15:16
@choojoyq choojoyq force-pushed the SPARK-29550-enhance-session-catalog-locking branch from c3232c5 to b50d8f7 Compare October 23, 2019 09:03
@choojoyq
Copy link
Author

@andrewor14 could you please take a look ?

@github-actions
Copy link

github-actions bot commented Feb 3, 2020

We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!

@github-actions github-actions bot added the Stale label Feb 3, 2020
@github-actions github-actions bot closed this Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants