drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Rogers (JIRA)" <j...@apache.org>
Subject [jira] (DRILL-5211) Queries fail due to direct memory fragmentation
Date Tue, 31 Jan 2017 19:06:51 GMT

    [ https://issues.apache.org/jira/browse/DRILL-5211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15837090#comment-15837090
] 

Paul Rogers edited comment on DRILL-5211 at 1/31/17 7:06 PM:
-------------------------------------------------------------

Retitled the bug from "External sort fails to allocate merge memory when plenty is free" because
the fragmentation issue occurs any time Drill processes text columns larger than 256 characters.
Whether fragmentation leads to an OOM depends on how much wider the column is than 256 characters,
how many concurrent queries run, the size of the direct memory pool, and many other factors.

This particular test case used 8K columns widths which is far beyond what Drill was designed
to handle at present. Thus, this bug falls into the "abusing the software" category.

A detailed analysis of the issue can be found here: https://github.com/paul-rogers/drill/wiki/Memory-Management


was (Author: paul-rogers):
Retitled the bug from "External sort fails to allocate merge memory when plenty is free" because
the fragmentation issue occurs any time Drill processes text columns larger than 256 characters.
Whether fragmentation leads to an OOM depends on how much wider the column is than 256 characters,
how many concurrent queries run, the size of the direct memory pool, and many other factors.

This particular test case used 8K columns widths which is far beyond what Drill was designed
to handle. Thus, this bug falls into the "abusing the software" category.

> Queries fail due to direct memory fragmentation
> -----------------------------------------------
>
>                 Key: DRILL-5211
>                 URL: https://issues.apache.org/jira/browse/DRILL-5211
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Paul Rogers
>            Assignee: Paul Rogers
>             Fix For: 1.9.0
>
>
> Consider a test of the external sort as follows:
> * Direct memory: 3GB
> * Input file: 18 GB, with one Varchar column of 8K width
> The sort runs, spilling to disk. Once all data arrives, the sort beings to merge the
results. But, to do that, it must first do an intermediate merge. For example, in this sort,
there are 190 spill files, but only 19 can be merged at a time. (Each merge file contains
128 MB batches, and only 19 can fit in memory, giving a total footprint of 2.5 GB, well below
the 3 GB limit.
> Yet, when loading batch xx, Drill fails with an OOM error. At that point, total available
direct memory is 3,817,865,216. (Obtained from {{maxMemory}} in the {{Bits}} class in the
JDK.)
> It appears that Drill wants to allocate 58,257,868 bytes, but the {{totalCapacity}} (again
in {{Bits}}) is already 3,800,769,206, causing an OOM.
> The problem is that, at this point, the external sort should not ask the system for more
memory. The allocator for the external sort is at just 1,192,350,366 before the allocation
request. Plenty of spare memory should be available, released when the in-memory batches were
spilled to disk prior to merging. Indeed, earlier in the run, the sort had reached a peak
memory usage of 2,710,716,416 bytes. This memory should be available for reuse during merging,
and is plenty sufficient to fill the particular request in question.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message