malinjawi commented on PR #13595: URL: https://github.com/apache/gluten/pull/13595#issuecomment-7050915880
> > > 1. **Velox off-heap allocations** generating native columnar batches. > > > 2. **In-flight Arrow batches** buffered in the queue (`QueueCapacity = 4`). > > > 3. **Lance's native Rust encoder buffers**, which (as noted in the description) are unmanaged by Spark's `TaskMemoryManager`. > > Thanks @malinjawi for addressing the review comments. > > One remaining gap - the per-column encoder buffering is the main uncounted component, but the runs only varied vector dimension and data size, not column count. Could you add one run with a wide schema (say 50–100 columns plus the vector column) to confirm the overhead scales with columns as described? > > Also, in VeloxLance.md it would help to include a rough formula or example (columns × 8 MiB × concurrent write tasks) and mention that S3 uploads add Lance buffers on top. > > With those, I'm happy to approve. Thanks @rajarajangs. I ran it with a wide schema: 10 to 100 long columns plus a 64-float vector column, 8 concurrent write tasks with 1.2M rows each, so every column's buffer fills. Memory the process grew by during the write, beyond reading the same columns: | Columns (+ vector) | Gluten, native write | Gluten, lance-spark's writer | 8 tasks x (columns + 1) x 8 MiB | |---|---|---|---| | 10 | 0.67 GiB | 0.55 GiB | 0.69 GiB | | 25 | 1.79 GiB | 1.63 GiB | 1.62 GiB | | 50 | 2.91 GiB | 2.75 GiB | 3.19 GiB | | 100 | 5.95 GiB | 6.27 GiB | 6.31 GiB | So it scales with the column count as described, the formula is a fair estimate, and both writers use about the same. Spark counts only about 0.2 GiB of it. The caveat that this was local testing only `VeloxLance.md` now has the formula with an example. It also notes that on an object store Lance 12 keeps up to 10 upload parts of 5 MiB in flight per file (`LANCE_UPLOAD_CONCURRENCY`, [source](https://github.com/lance-format/lance/blob/v12.0.0/rust/lance-io/src/object_writer.rs#L28-L38)), so about 55 MiB more per write task. 8 tasks writing 20 columns to S3 come to about 1.7 GiB. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
