Github user Ben-Zvi commented on a diff in the pull request:

    https://github.com/apache/drill/pull/761#discussion_r103067856
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/managed/ExternalSortBatch.java
 ---
    @@ -392,22 +448,31 @@ private void configure(DrillConfig config) {
         // Set too large and the ratio between memory and input data sizes 
becomes
         // small. Set too small and disk seek times dominate performance.
     
    -    spillBatchSize = 
config.getBytes(ExecConstants.EXTERNAL_SORT_SPILL_BATCH_SIZE);
    -    spillBatchSize = Math.max(spillBatchSize, MIN_SPILL_BATCH_SIZE);
    +    preferredSpillBatchSize = 
config.getBytes(ExecConstants.EXTERNAL_SORT_SPILL_BATCH_SIZE);
    +
    +    // In low memory, use no more than 1/4 of memory for each spill batch. 
Ensures we
    +    // can merge.
    +
    +    preferredSpillBatchSize = Math.min(preferredSpillBatchSize, 
memoryLimit / 4);
    +
    +    // But, the spill batch should be above some minimum size to prevent 
complete
    +    // thrashing.
    +
    +    preferredSpillBatchSize = Math.max(preferredSpillBatchSize, 
MIN_SPILL_BATCH_SIZE);
    --- End diff --
    
    Do we need some sanity check to ensure that the MIN_SPILL is smaller than 
the memory limit ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to