Commit 2613bb8
[GOBBLIN-2257] Parallelize flow compilation on submission path (#4175)
* Parallelize flow compilation on submission path
Flow compilation happens twice: on submission and on execution. The execution
path already runs on a thread pool of size 3 (DagProcessingEngine), but the
submission path was serialized by a synchronized block in
SpecCatalogListenersList.onAddSpec() and a single-thread executor in
CallbacksDispatcher.
This change removes the synchronized keyword from onAddSpec() and replaces
the single-thread executor with a configurable thread pool (default 3 threads),
allowing multiple flows to compile in parallel during submission. Compilation
is still serialized per flow but multiple flows now compile concurrently.
The thread pool size is configurable via:
gobblin.service.specCatalogListener.numThreads (default: 3)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Use bounded ThreadPoolExecutor with CallerRunsPolicy
Replace Executors.newFixedThreadPool (unbounded queue) with a bounded
ThreadPoolExecutor to prevent memory growth under heavy submission load.
Queue capacity is set to numThreads * 10 with CallerRunsPolicy so that
when the queue is full, the submitting thread runs the compilation
itself, providing natural backpressure.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add comments explaining parallelization rationale
Add inline comment in FlowCatalog explaining why the submission path
is now parallelized and Javadoc on the new SpecCatalogListenersList
constructor documenting the design decision and thread-safety reasoning.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Daisy Modi <dmodi@linkedin.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 26406a8 commit 2613bb8
3 files changed
Lines changed: 35 additions & 2 deletions
File tree
- gobblin-api/src/main/java/org/apache/gobblin/service
- gobblin-runtime/src/main/java/org/apache/gobblin/runtime/spec_catalog
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
162 | 164 | | |
163 | 165 | | |
164 | 166 | | |
| |||
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| |||
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| 69 | + | |
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
| |||
110 | 115 | | |
111 | 116 | | |
112 | 117 | | |
113 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
114 | 132 | | |
115 | 133 | | |
116 | 134 | | |
| |||
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
50 | 63 | | |
51 | 64 | | |
52 | 65 | | |
| |||
66 | 79 | | |
67 | 80 | | |
68 | 81 | | |
69 | | - | |
| 82 | + | |
70 | 83 | | |
71 | 84 | | |
72 | 85 | | |
| |||
0 commit comments