Commit 48a9b93
authored
[query|batch] collect partition results as they complete (#15316)
## Change Description
Modifies the query `ServiceBackend` to collect partititon results
incrementally, instead of waiting for the job group to complete. It does
this by fetching succeeded jobs whose `end_time` is greater than the
maximum from the previous batch of jobs.
The batch service front end needed the following modifications:
- Include the job's `end_time` in http responses via
`JobListEntryV1Alpha` (and consequently `GetJobResponseV1Alpha`)
- Include milliseconds in date time string format (previously truncated
to seconds).
The first has the performance implication of always joining with the
attempts table. I see no way around this without a more significant
change to enable this new query-on-batch capability. The
`JobEndTimeQuery` has been simplified as a consequence.
Driver memory usage has significantly reduced as a consequence of this
change. I've included before and after screenshots of the driver's cpu
and memory usage in a stress test of force-counting a range table with
10,000 rows and partitions. Before this change, the driver needed 21GB
to collect these results. This change reduces that to <2GB meaning it
can now run on a standard worker.


Through this testing, I discovered that `end_time` isn't a very good
index for incrementally collecting jobs. Due to the lack of ordering
guarantees on attempt `end_time`, I noticed a significant number of jobs
were never returned by the batch service while using a polling interval
of `[500, 5000]` ms. Doubling this interval reduced the number of
stragglers by half which is somewhat intuitive. I don't think increasing
futher is a good solution; instead we should consider other ways to get
jobs we haven't processed.
This change reduces the maximum number of parallel reads from 1000 to
50. 50 is the page size batch uses in job responses. After experimenting
a bit I found out that, for this test at least, increasing the
parallelism didn't decrease wall clock time, only memory consumption.
Fixes #15288, #14607
## Security Assessment
This change potentially impacts the Hail Batch instance as deployed by
Broad Institute in GCP
### Impact Rating
This change has a low security impact
### Impact Description
The changes primarily involve database query optimizations and internal
API enhancements for job result collection. The modifications add
time-based filtering capabilities and improve query efficiency without
introducing new external interfaces or changing
authentication/authorization mechanisms. All changes maintain existing
data validation and access control patterns.
### Appsec Review
- [ ] Required: The impact has been assessed and approved by appsec1 parent 566f39f commit 48a9b93
13 files changed
Lines changed: 501 additions & 297 deletions
File tree
- batch/batch
- front_end
- query
- hail
- hail
- src/is/hail
- backend/service
- services
- test/src/is/hail
- backend
- services
- python
- hailtop
- batch_client
- utils
- test/hailtop/utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
142 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
143 | 146 | | |
144 | 147 | | |
145 | 148 | | |
| |||
151 | 154 | | |
152 | 155 | | |
153 | 156 | | |
| 157 | + | |
154 | 158 | | |
155 | 159 | | |
156 | 160 | | |
157 | | - | |
| 161 | + | |
158 | 162 | | |
159 | 163 | | |
160 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2327 | 2327 | | |
2328 | 2328 | | |
2329 | 2329 | | |
2330 | | - | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
2331 | 2337 | | |
2332 | 2338 | | |
2333 | 2339 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
| 276 | + | |
281 | 277 | | |
282 | 278 | | |
283 | 279 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
271 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
272 | 276 | | |
273 | 277 | | |
274 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
275 | 283 | | |
276 | 284 | | |
277 | 285 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
281 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
282 | 288 | | |
283 | 289 | | |
284 | 290 | | |
285 | 291 | | |
286 | 292 | | |
287 | 293 | | |
288 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
289 | 299 | | |
290 | 300 | | |
291 | 301 | | |
| |||
0 commit comments