[ZEPPELIN-6129] Restore parallel paragraph execution for concurrent interpreters - #5332
Open
HwangRock wants to merge 1 commit into
Open
[ZEPPELIN-6129] Restore parallel paragraph execution for concurrent interpreters#5332HwangRock wants to merge 1 commit into
HwangRock wants to merge 1 commit into
Conversation
…nterpreters RemoteScheduler serialized every remote submission through a per-scheduler single-thread executor, so paragraphs of the same interpreter ran sequentially even when the interpreter's remote scheduler is a ParallelScheduler. This regressed from [ZEPPELIN-5900] (apache#4582), which switched the shared multi-threaded pool to newSingleThreadExecutor to make testAbortOnPending deterministic. Replace the JDBC-only concurrency gate with an interpreter-neutral bounded pool for paragraph mode (note mode stays single-threaded); actual parallelism is delegated to each interpreter's remote-side scheduler, so FIFO interpreters stay serial and concurrent ones run in parallel. Harden cancellation for the now-multithreaded pool: make Job.aborted volatile, run the runJob abort gate under synchronized(runningJob), and guard JDBCUserConfigurations with ConcurrentHashMap + a null check in cancelStatement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this PR for?
Paragraphs of the same interpreter cannot run in parallel, even when the interpreter is configured for concurrent execution (e.g. a presto JDBC interpreter with
zeppelin.jdbc.concurrent.use=true).This is a regression from [ZEPPELIN-5900] (#4582). That PR switched
RemoteScheduler's executor to a per-schedulernewSingleThreadExecutorso thatRemoteSchedulerTest.testAbortOnPendingbecame deterministic. Before it,RemoteSchedulerwas constructed with the shared multi-threaded pool fromSchedulerFactory.getExecutor(), and every interpreter could submit paragraphs to the remote side concurrently.Scheduling is two-tier: the server-side
RemoteScheduleris a proxy, and each interpreter's remote-sidegetScheduler()(FIFO vs Parallel) decides the real concurrency. Once the server side became single-threaded, it gated every interpreter behind a single in-flight submission, so a remoteParallelSchedulernever received a second job to run. The JDBC concurrency flag was read on the remote side but the server side never let a second paragraph through.The fix restores an interpreter-neutral pool on the server side and delegates parallelism back to the remote scheduler:
RemoteScheduler: paragraph mode now builds a boundednewFixedThreadPoolsized fromzeppelin.interpreter.connection.poolsize(default 100, matching the RPC connection pool). Note mode keepsnewSingleThreadExecutorto preserve in-note paragraph ordering. The JDBC-specificzeppelin.jdbc.concurrent.*gate is removed — it only helped JDBC and left Shell / Markdown / MongoDB / Neo4j / Cassandra / Flink SQL and other always-parallel interpreters serialized on the server side.runJobInScheduleris untouched. It is what keeps FIFO interpreters (Python, Spark, ...) serial and note mode ordered: a FIFO interpreter's second job never reaches RUNNING remotely, so the wait still serializes it.Job.abortedisvolatile, andAbstractScheduler.runJob's abort gate runs undersynchronized(runningJob), so a cancel arriving right before run reliably skips execution instead of racing.JDBCUserConfigurations:paragraphIdStatementMapis aConcurrentHashMapandcancelStatementnull-checks the statement, so a cancel arriving before the statement is registered is a no-op rather than an NPE.Net effect: interpreters whose remote
getScheduler()returns aParallelScheduler(Shell, Markdown, MongoDB, Neo4j, Cassandra, Flink SQL, JDBC with concurrency on, ...) regain parallel paragraph execution; FIFO interpreters and note mode stay serial.What type of PR is it?
Bug Fix
What is the Jira issue?
ZEPPELIN-6129
How should this be tested?
Unit / integration:
RemoteSchedulerTest#testParallelExecution_bothJobsRunConcurrently— two jobs reach RUNNING simultaneously throughRemoteScheduler; fails against the single-thread executor, passes with the neutral pool.RemoteSchedulerTest#testAbortOnPending_noteModeSerial— note mode still serializes and aborts a queued job before it runs.AbstractSchedulerAbortRaceTest— the abort gate and cancel share the job monitor (latch-driven, deterministic).JDBCUserConfigurationsTest— cancel-before-register is a no-op, not an NPE.End-to-end (verified locally against a real server; the IT itself is kept out of this PR to keep CI light): two
%shparagraphs each runningsleep 5, triggered via the async REST endpointPOST /api/notebook/job/{noteId}/{paragraphId}, with no concurrency property set (Shell is aParallelSchedulerby default). Status was polled and the two paragraphs were observed RUNNING at the same time:Serial execution would be ~10000ms (2 x sleep 5), and a single-thread pool can never reach simultaneous RUNNING because the second paragraph stays PENDING until the first finishes. The overlap at +3425ms and the ~8.3s wall-clock confirm the two paragraphs ran in parallel.
Questions: