You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Manifests reader queue in ParallelIterable is unlimited caused OOM #7843
ParallelIterable use ConcurrentLinkedQueue to read manifests file. If we have too many files in our iceberg table, this queue will take up too much memory. I recommend using LinkedBlockingQueue to limit to avoid driver/coordinator OOM.
We have an iceberg table with millions of files and a few hundred columns. A FileScanTask will use 50KB memory because the complex schema, millions will totally use almost 50GB memory in this queue.
This has come up before and the issue is actually that the table has too many files, not that we need to change the design of the queue within ParallelIterable. The queue filling up is usually a symptom of needing to compact data in the table. @Heltman can you run a query to summarize the files in your table? How many are there and what is the average size? How many partitions and what's the distribution of file sizes within those partitions?
@rdblue We have table with 400 partitions, every partition with 10k files, every files with 64~256MB. Total size ~500TB. Table has ~100 columns with complex types. As I see, one FileScanTask use 20KB memory, our trino coordinator have 40cores, default use 80 threads load to this queue. Which means at least we used 15GB (80 x 10k x 20KB) memory in this queue. When we has 4 queries, coordinator will oom.
@zinking LinkedBlockingQueue can limit the queue size, and block read manifests thread. In fact, the user just query similar to select * limit, but needs to read all metadata.
Activity
nastra commentedon Jun 15, 2023
@Heltman thanks for reporting this. Would you be interested in providing a PR to fix this?
Heltman commentedon Jun 15, 2023
@nastra I give a PR. I wonder if we need to add performance related tests.
rdblue commentedon Jun 19, 2023
This has come up before and the issue is actually that the table has too many files, not that we need to change the design of the queue within
ParallelIterable. The queue filling up is usually a symptom of needing to compact data in the table. @Heltman can you run a query to summarize the files in your table? How many are there and what is the average size? How many partitions and what's the distribution of file sizes within those partitions?Heltman commentedon Jun 20, 2023
@rdblue We have table with 400 partitions, every partition with 10k files, every files with 64~256MB. Total size ~500TB. Table has ~100 columns with complex types. As I see, one FileScanTask use 20KB memory, our trino coordinator have 40cores, default use 80 threads load to this queue. Which means at least we used 15GB (80 x 10k x 20KB) memory in this queue. When we has 4 queries, coordinator will oom.
zinking commentedon Jun 21, 2023
can you explain a bit more why a linkedq makes difference ?
in your calculation you are assuming the whole partition is loaded, is this the common case ?
Heltman commentedon Jun 21, 2023
@zinking LinkedBlockingQueue can limit the queue size, and block read manifests thread. In fact, the user just query similar to
select * limit, but needs to read all metadata.