You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org> on 2012/09/17 05:00:07 UTC

[jira] [Created] (PIG-2923) Lazily register bags with SpillableMemoryManager

Dmitriy V. Ryaboy created PIG-2923:
--------------------------------------

             Summary: Lazily register bags with SpillableMemoryManager
                 Key: PIG-2923
                 URL: https://issues.apache.org/jira/browse/PIG-2923
             Project: Pig
          Issue Type: Improvement
            Reporter: Dmitriy V. Ryaboy


Currently, all Spillable DataBags get registered by the BagFactory at the moment of creation. In practice, a lot of these bags will not get large enough to be worth spilling; we can avoid a lot of memory overhead and cheapen the process of finding a bag to spill when we do need it, by allowing Bags themselves to register when they grow to some respectable threshold.

Related JIRAs: PIG-2917, PIG-2918

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIG-2923) Lazily register bags with SpillableMemoryManager

Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13465275#comment-13465275 ] 

Dmitriy V. Ryaboy commented on PIG-2923:
----------------------------------------

review bump :)
                
> Lazily register bags with SpillableMemoryManager
> ------------------------------------------------
>
>                 Key: PIG-2923
>                 URL: https://issues.apache.org/jira/browse/PIG-2923
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Dmitriy V. Ryaboy
>            Assignee: Dmitriy V. Ryaboy
>         Attachments: bagspill_delayed_register.patch, bagspill_delay.patch
>
>
> Currently, all Spillable DataBags get registered by the BagFactory at the moment of creation. In practice, a lot of these bags will not get large enough to be worth spilling; we can avoid a lot of memory overhead and cheapen the process of finding a bag to spill when we do need it, by allowing Bags themselves to register when they grow to some respectable threshold.
> Related JIRAs: PIG-2917, PIG-2918

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIG-2923) Lazily register bags with SpillableMemoryManager

Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13461226#comment-13461226 ] 

Dmitriy V. Ryaboy commented on PIG-2923:
----------------------------------------

bq. Shouldn't that be >= instead of == ? You may have already passed the size the first time you check

Yeah that's a leftover from when I was trying to avoid having a "spillableRegistered" boolean added to bag overhead. I'll fix the conditional.

bq. In TestDataBag, why control the seed? Is this for repeatability of the test?

Yep.
                
> Lazily register bags with SpillableMemoryManager
> ------------------------------------------------
>
>                 Key: PIG-2923
>                 URL: https://issues.apache.org/jira/browse/PIG-2923
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Dmitriy V. Ryaboy
>            Assignee: Dmitriy V. Ryaboy
>         Attachments: bagspill_delayed_register.patch
>
>
> Currently, all Spillable DataBags get registered by the BagFactory at the moment of creation. In practice, a lot of these bags will not get large enough to be worth spilling; we can avoid a lot of memory overhead and cheapen the process of finding a bag to spill when we do need it, by allowing Bags themselves to register when they grow to some respectable threshold.
> Related JIRAs: PIG-2917, PIG-2918

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (PIG-2923) Lazily register bags with SpillableMemoryManager

Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2923?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitriy V. Ryaboy reassigned PIG-2923:
--------------------------------------

    Assignee: Dmitriy V. Ryaboy
    
> Lazily register bags with SpillableMemoryManager
> ------------------------------------------------
>
>                 Key: PIG-2923
>                 URL: https://issues.apache.org/jira/browse/PIG-2923
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Dmitriy V. Ryaboy
>            Assignee: Dmitriy V. Ryaboy
>
> Currently, all Spillable DataBags get registered by the BagFactory at the moment of creation. In practice, a lot of these bags will not get large enough to be worth spilling; we can avoid a lot of memory overhead and cheapen the process of finding a bag to spill when we do need it, by allowing Bags themselves to register when they grow to some respectable threshold.
> Related JIRAs: PIG-2917, PIG-2918

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (PIG-2923) Lazily register bags with SpillableMemoryManager

Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2923?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitriy V. Ryaboy updated PIG-2923:
-----------------------------------

    Status: Patch Available  (was: Open)
    
> Lazily register bags with SpillableMemoryManager
> ------------------------------------------------
>
>                 Key: PIG-2923
>                 URL: https://issues.apache.org/jira/browse/PIG-2923
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Dmitriy V. Ryaboy
>            Assignee: Dmitriy V. Ryaboy
>         Attachments: bagspill_delayed_register.patch
>
>
> Currently, all Spillable DataBags get registered by the BagFactory at the moment of creation. In practice, a lot of these bags will not get large enough to be worth spilling; we can avoid a lot of memory overhead and cheapen the process of finding a bag to spill when we do need it, by allowing Bags themselves to register when they grow to some respectable threshold.
> Related JIRAs: PIG-2917, PIG-2918

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIG-2923) Lazily register bags with SpillableMemoryManager

Posted by "Alan Gates (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13459751#comment-13459751 ] 

Alan Gates commented on PIG-2923:
---------------------------------

In DefaultAbstractBag it would be good to have a comment on the definition of SPILL_REGISTER_THRESHOLD to say what the unit is (K I think).

DefaultAbstractBag.markSpillableIfNecessary in the line:
{code}
if (!spillableRegistered && size() == SPILL_REGISTER_THRESHOLD)
{code}

Shouldn't that be >= instead of == ?  You may have already passed the size the first time you check.

In TestDataBag, why control the seed?  Is this for repeatability of the test?
                
> Lazily register bags with SpillableMemoryManager
> ------------------------------------------------
>
>                 Key: PIG-2923
>                 URL: https://issues.apache.org/jira/browse/PIG-2923
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Dmitriy V. Ryaboy
>            Assignee: Dmitriy V. Ryaboy
>         Attachments: bagspill_delayed_register.patch
>
>
> Currently, all Spillable DataBags get registered by the BagFactory at the moment of creation. In practice, a lot of these bags will not get large enough to be worth spilling; we can avoid a lot of memory overhead and cheapen the process of finding a bag to spill when we do need it, by allowing Bags themselves to register when they grow to some respectable threshold.
> Related JIRAs: PIG-2917, PIG-2918

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (PIG-2923) Lazily register bags with SpillableMemoryManager

Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2923?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitriy V. Ryaboy updated PIG-2923:
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 0.11
           Status: Resolved  (was: Patch Available)

Committed to trunk.
                
> Lazily register bags with SpillableMemoryManager
> ------------------------------------------------
>
>                 Key: PIG-2923
>                 URL: https://issues.apache.org/jira/browse/PIG-2923
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Dmitriy V. Ryaboy
>            Assignee: Dmitriy V. Ryaboy
>             Fix For: 0.11
>
>         Attachments: bagspill_delayed_register.patch, bagspill_delay.patch
>
>
> Currently, all Spillable DataBags get registered by the BagFactory at the moment of creation. In practice, a lot of these bags will not get large enough to be worth spilling; we can avoid a lot of memory overhead and cheapen the process of finding a bag to spill when we do need it, by allowing Bags themselves to register when they grow to some respectable threshold.
> Related JIRAs: PIG-2917, PIG-2918

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIG-2923) Lazily register bags with SpillableMemoryManager

Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13461230#comment-13461230 ] 

Dmitriy V. Ryaboy commented on PIG-2923:
----------------------------------------

New patch attached, please review.
                
> Lazily register bags with SpillableMemoryManager
> ------------------------------------------------
>
>                 Key: PIG-2923
>                 URL: https://issues.apache.org/jira/browse/PIG-2923
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Dmitriy V. Ryaboy
>            Assignee: Dmitriy V. Ryaboy
>         Attachments: bagspill_delayed_register.patch, bagspill_delay.patch
>
>
> Currently, all Spillable DataBags get registered by the BagFactory at the moment of creation. In practice, a lot of these bags will not get large enough to be worth spilling; we can avoid a lot of memory overhead and cheapen the process of finding a bag to spill when we do need it, by allowing Bags themselves to register when they grow to some respectable threshold.
> Related JIRAs: PIG-2917, PIG-2918

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIG-2923) Lazily register bags with SpillableMemoryManager

Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13461228#comment-13461228 ] 

Dmitriy V. Ryaboy commented on PIG-2923:
----------------------------------------

Oh wow the patch I attached was the old version that breaks DistinctDataBag (due to the fact that size() on DDB makes it non-distinct.. ). The version I have sitting on my laptop uses getMemorySize() and does document what "spill_register_threshold" is (between patches it changes from 100 elements to 100 KB in ram).
                
> Lazily register bags with SpillableMemoryManager
> ------------------------------------------------
>
>                 Key: PIG-2923
>                 URL: https://issues.apache.org/jira/browse/PIG-2923
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Dmitriy V. Ryaboy
>            Assignee: Dmitriy V. Ryaboy
>         Attachments: bagspill_delayed_register.patch
>
>
> Currently, all Spillable DataBags get registered by the BagFactory at the moment of creation. In practice, a lot of these bags will not get large enough to be worth spilling; we can avoid a lot of memory overhead and cheapen the process of finding a bag to spill when we do need it, by allowing Bags themselves to register when they grow to some respectable threshold.
> Related JIRAs: PIG-2917, PIG-2918

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (PIG-2923) Lazily register bags with SpillableMemoryManager

Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2923?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitriy V. Ryaboy updated PIG-2923:
-----------------------------------

    Attachment: bagspill_delay.patch
    
> Lazily register bags with SpillableMemoryManager
> ------------------------------------------------
>
>                 Key: PIG-2923
>                 URL: https://issues.apache.org/jira/browse/PIG-2923
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Dmitriy V. Ryaboy
>            Assignee: Dmitriy V. Ryaboy
>         Attachments: bagspill_delayed_register.patch, bagspill_delay.patch
>
>
> Currently, all Spillable DataBags get registered by the BagFactory at the moment of creation. In practice, a lot of these bags will not get large enough to be worth spilling; we can avoid a lot of memory overhead and cheapen the process of finding a bag to spill when we do need it, by allowing Bags themselves to register when they grow to some respectable threshold.
> Related JIRAs: PIG-2917, PIG-2918

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIG-2923) Lazily register bags with SpillableMemoryManager

Posted by "Alan Gates (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13465793#comment-13465793 ] 

Alan Gates commented on PIG-2923:
---------------------------------

+1.
                
> Lazily register bags with SpillableMemoryManager
> ------------------------------------------------
>
>                 Key: PIG-2923
>                 URL: https://issues.apache.org/jira/browse/PIG-2923
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Dmitriy V. Ryaboy
>            Assignee: Dmitriy V. Ryaboy
>         Attachments: bagspill_delayed_register.patch, bagspill_delay.patch
>
>
> Currently, all Spillable DataBags get registered by the BagFactory at the moment of creation. In practice, a lot of these bags will not get large enough to be worth spilling; we can avoid a lot of memory overhead and cheapen the process of finding a bag to spill when we do need it, by allowing Bags themselves to register when they grow to some respectable threshold.
> Related JIRAs: PIG-2917, PIG-2918

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (PIG-2923) Lazily register bags with SpillableMemoryManager

Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2923?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitriy V. Ryaboy updated PIG-2923:
-----------------------------------

    Attachment: bagspill_delayed_register.patch

This patch introduces the following changes:

1) Make SpillableMemoryManager a real singleton (before, it was assumed to be a singleton, but the assumption was not enforced)

2) deprecates BagFactory's registerBag() method, as it is no longer a Factory's job to do this. Also removes calls to this method from the default implementation.

3) gets rid of some redundant code for addAll() methods in various databag implementations

4) introduces a markSpillableIfNecessary method in AbstractDataBag, which will register with the SMM if necessary (upon reaching a memory threshold of 100K).

5) adds markSpillableIfNecessary calls to all spillable DataBags' add() methods.

TestDataBag passes, test-commit passes, TestDataBagAccess passes.

While testing this, I discovered the fun fact that calling _size() on a DistinctDataBag causes it to stop being distinct_. But that's for a different jira...
                
> Lazily register bags with SpillableMemoryManager
> ------------------------------------------------
>
>                 Key: PIG-2923
>                 URL: https://issues.apache.org/jira/browse/PIG-2923
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Dmitriy V. Ryaboy
>            Assignee: Dmitriy V. Ryaboy
>         Attachments: bagspill_delayed_register.patch
>
>
> Currently, all Spillable DataBags get registered by the BagFactory at the moment of creation. In practice, a lot of these bags will not get large enough to be worth spilling; we can avoid a lot of memory overhead and cheapen the process of finding a bag to spill when we do need it, by allowing Bags themselves to register when they grow to some respectable threshold.
> Related JIRAs: PIG-2917, PIG-2918

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira