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

ASF GitHub Bot commented on DRILL-4134:
---------------------------------------

Github user julienledem commented on a diff in the pull request:

    https://github.com/apache/drill/pull/283#discussion_r46316409
  
    --- Diff: 
exec/memory/base/src/main/java/org/apache/drill/exec/memory/README.md ---
    @@ -0,0 +1,121 @@
    +<!--
    + Licensed to the Apache Software Foundation (ASF) under one
    + or more contributor license agreements.  See the NOTICE file
    + distributed with this work for additional information
    + regarding copyright ownership.  The ASF licenses this file
    + to you under the Apache License, Version 2.0 (the
    + "License"); you may not use this file except in compliance
    + with the License.  You may obtain a copy of the License at
    + 
    + http://www.apache.org/licenses/LICENSE-2.0
    + 
    + Unless required by applicable law or agreed to in writing, software
    + distributed under the License is distributed on an "AS IS" BASIS,
    + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + See the License for the specific language governing permissions and
    + limitations under the License.
    +-->
    +# Memory: Allocation, Accounting and Management
    + 
    +The memory management package contains all the memory allocation related 
items that Drill uses to manage memory.
    +
    +
    +## Key Components
    +Memory management can be broken into the following main components:
    +
    +- Memory chunk allocation and fragmentation management
    +  - `PooledByteBufAllocatorL` - A LittleEndian clone of Netty's jemalloc 
implementation
    +  - `UnsafeDirectLittleEndian` - A base level memory access interface
    +  - `LargeBuffer` - A buffer backing implmentation used when working with 
data larger than one Netty chunk (default to 16mb)
    +- Memory limits & Accounting
    +  - `Accountant` - A nestable class of lockfree memory accountors.
    +- Application-level memory allocation
    +  - `BufferAllocator` - The public interface application users should be 
leveraging
    +  - `BaseAllocator` - The base implementation of memory allocation, 
contains the meat of our the Drill allocator implementation
    +  - `RootAllocator` - The root allocator. Typically only one created for a 
JVM
    +  - `ChildAllocator` - A child allocator that derives from the root 
allocator
    +- Buffer ownership and transfer capabilities
    +  - `AllocatorManager` - Responsible for managing the relationship between 
multiple allocators and a single chunk of memory
    +  - `BufferLedger` - Responsible for allowing maintaining the relationship 
between an `AllocatorManager`, a `BufferAllocator` and one or more individual 
`DrillBuf`s 
    +- Memory access
    +  - `DrillBuf` - The facade for interacting directly with a chunk of 
memory.
    + 
    +
    +## Memory Management Overview
    +Drill's memory model is based on the following basic concepts:
    +
    + - Memory can be allocated up to some limit. That limit could be a real 
limit (OS/JVM) or a locally imposed limit.
    + - Allocation operates in two phases: accounting then actual allocation. 
Allocation could fail at either point.
    + - Allocation failure should be recoverable. In all cases, the Allocator 
infrastructure should expose memory allocation failures (OS or internal 
limit-based) as `OutOfMemoryException`s.
    + - Any allocator can reserve memory when created. This memory shall be 
held such that this allocator will always be able to allocate that amount of 
memory.
    + - A particular application component should work to use a local allocator 
to understand local memory usage and better debug memory leaks.
    + - The same physical memory can be shared by multiple allocators and the 
allocator must provide an accounting paradigm for this purpose.
    +
    +## Allocator Trees
    +
    +Drill provides a tree-based model for memory allocation. The RootAllocator 
is created first, then all allocators are created as children of that 
allocator. The RootAllocator is responsible for being the master bookeeper for 
memory allocations. All other allocators are created as children of this tree. 
Each allocator can first determine whether it has enough local memory to 
satisfy a particular request. If not, the allocator can ask its parent for an 
additional memory allocation.
    +
    +## Reserving Memory
    +
    +Drill provides two different ways to reserve memory:
    +
    +  - BufferAllocator accounting reservations: 
    +      When a new allocator (other than the `RootAllocator`) is 
initialized, it can set aside memory that it will keep locally for its 
lifetime. This is memory that will never be released back to its parent 
allocator until the allocator
    --- End diff --
    
    missing end of sentence?


> Incorporate remaining patches from DRILL-1942 Allocator refactor
> ----------------------------------------------------------------
>
>                 Key: DRILL-4134
>                 URL: https://issues.apache.org/jira/browse/DRILL-4134
>             Project: Apache Drill
>          Issue Type: Sub-task
>          Components: Execution - Flow
>            Reporter: Jacques Nadeau
>            Assignee: Jacques Nadeau
>             Fix For: 1.4.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to