Source:
<code>private void verifyDirectMemory(DruidProcessingConfig config) { try { final long maxDirectMemory = JvmUtils.getRuntimeInfo().getDirectMemorySizeBytes(); final long memoryNeeded = (long) config.intermediateComputeSizeBytes() * (config.getNumMergeBuffers() + config.getNumThreads() + 1); if (maxDirectMemory < memoryNeeded) { throw new ProvisionException( StringUtils.format( "Not enough direct memory. Please adjust -XX:MaxDirectMemorySize, druid.processing.buffer.sizeBytes, druid.processing.numThreads, or druid.processing.numMergeBuffers: " + "maxDirectMemory[%,d], memoryNeeded[%,d] = druid.processing.buffer.sizeBytes[%,d] * (druid.processing.numMergeBuffers[%,d] + druid.processing.numThreads[%,d] + 1)", maxDirectMemory, memoryNeeded, config.intermediateComputeSizeBytes(), config.getNumMergeBuffers(), config.getNumThreads() ) ); } } catch (UnsupportedOperationException e) { log.debug("Checking for direct memory size is not support on this platform: %s", e); log.info( "Unable to determine max direct memory size. If -XX:MaxDirectMemorySize is set, make sure " + "a) -XX:MaxDirectMemorySize is set to at least [%,d] bytes (25%% of maximum heap size), or " + "b) set druid.processing.buffer.sizeBytes, such that " + "druid.processing.buffer.sizeBytes * (druid.processing.numMergeBuffers[%,d] + druid.processing.numThreads[%,d] + 1) " <START> + "does not exceed the value of -XX:MaxDirectMemorySize", <END> DruidProcessingConfig.computeMaxMemoryFromMaxHeapSize(), config.getNumMergeBuffers(), config.getNumThreads() ); } }</code><technical_language>optional nit: this is confusing for me, reworded suggestion Unable determine max direct memory size. If druid.processing.buffer.sizeBytes is explicitly set set -XX:MaxDirectMemorySize "druid.processing.buffer.sizeBytes * (druid.processing.numMergeBuffers[%,d] + druid.processing.numThreads[%,d] + 1)" else set 25% of maximum jvm heap size</technical_language>

Target:
private void verifyDirectMemory(DruidProcessingConfig config) { try { final long maxDirectMemory = JvmUtils.getRuntimeInfo().getDirectMemorySizeBytes(); final long memoryNeeded = (long) config.intermediateComputeSizeBytes() * (config.getNumMergeBuffers() + config.getNumThreads() + 1); if (maxDirectMemory < memoryNeeded) { throw new ProvisionException( StringUtils.format( "Not enough direct memory. Please adjust -XX:MaxDirectMemorySize, druid.processing.buffer.sizeBytes, druid.processing.numThreads, or druid.processing.numMergeBuffers: " + "maxDirectMemory[%,d], memoryNeeded[%,d] = druid.processing.buffer.sizeBytes[%,d] * (druid.processing.numMergeBuffers[%,d] + druid.processing.numThreads[%,d] + 1)", maxDirectMemory, memoryNeeded, config.intermediateComputeSizeBytes(), config.getNumMergeBuffers(), config.getNumThreads() ) ); } } catch (UnsupportedOperationException e) { log.debug("Checking for direct memory size is not support on this platform: %s", e); log.info( "Unable to determine max direct memory size. If druid.processing.buffer.sizeBytes is explicitly configured, " + "then make sure to set -XX:MaxDirectMemorySize to at least \"druid.processing.buffer.sizeBytes * " + "(druid.processing.numMergeBuffers[%,d] + druid.processing.numThreads[%,d] + 1)\", " + "or else set -XX:MaxDirectMemorySize to at least 25%% of maximum jvm heap size.", config.getNumMergeBuffers(), config.getNumThreads() ); } }