More fine-grained DI for management node types. Don't allocate processing resources on Router#4429
Conversation
…odule from DI for coordinator, overlord, middle-manager. Add RouterDruidProcessing not to allocate processing resources on router
|
@gianm could you please review this pr? |
gianm
left a comment
There was a problem hiding this comment.
General approach looks reasonable. Didn't review all the X-Pool refactors yet.
|
|
||
| # Processing threads and buffers | ||
| druid.processing.buffer.sizeBytes=256000000 | ||
| druid.processing.numThreads=2 |
There was a problem hiding this comment.
These are still useful since they're passed down to tasks. It would be better if the MM ignored them for its own processing pool (since it doesn't need one!) but still "remembered" them to pass down to each task.
There was a problem hiding this comment.
Isn't it configured as druid.indexer.fork.property.druid.processing.numThreads=2
There was a problem hiding this comment.
Currently both druid.indexer.fork.property.druid.processing.numThreads and druid.processing.numThreads would work (all druid.* properties are passed down automatically). A number of deployments depend on the latter form so it should keep working. fwiw, I also think it's prettier than the former, so I wouldn't want to deprecate it.
There was a problem hiding this comment.
Reverted those example configs but with druid.indexer.fork.property. prefixes because IMO it's less confusing, and leaves less room for mistakes (e. g. when configs for different node types are shared, or copied when people base configs for one node type on config for another node type, etc.)
| if (numThreadsConfigured != DEFAULT_NUM_THREADS) { | ||
| return numThreadsConfigured; | ||
| } else { | ||
| return Runtime.getRuntime().availableProcessors() - 1; |
There was a problem hiding this comment.
I suspect this code is unused (or maybe lightly used) or else someone would have complained by now that it doesn't work when you only have one processor. It should be max(1, Runtime.getRuntime().availableProcessors() - 1).
| } else { | ||
| // default to leaving one core for background tasks | ||
| final int processors = Runtime.getRuntime().availableProcessors(); | ||
| return processors > 1 ? processors - 1 : processors; |
There was a problem hiding this comment.
This overrides getNumThreads from ExecutorServiceConfig, which maybe explains why nobody has complained about the bug there yet.
There was a problem hiding this comment.
Removed this method, because it seems to be identical to the overridden method.
| public BlockingPool<ByteBuffer> getMergeBufferPool(DruidProcessingConfig config) | ||
| { | ||
| if (config.getNumMergeBuffersConfigured() != DruidProcessingConfig.DEFAULT_NUM_MERGE_BUFFERS) { | ||
| log.error( |
There was a problem hiding this comment.
warn is probably more appropriate as nothing will really break here -- it's just a misguided configuration.
| public ExecutorService getProcessingExecutorService(DruidProcessingConfig config) | ||
| { | ||
| if (config.getNumThreadsConfigured() != ExecutorServiceConfig.DEFAULT_NUM_THREADS) { | ||
| log.error("numThreads[%d] configured, that is ingnored on Router", config.getNumThreadsConfigured()); |
There was a problem hiding this comment.
"ignored" (spelling). Also, as below, warn is probably more appropriate.
There was a problem hiding this comment.
Fixed spelling.
Made it error deliberately, because in the future DruidProcessingConfig shouldn't be injected on Router.
| protected List<? extends Module> getModules() | ||
| { | ||
| return ImmutableList.of( | ||
| new DruidProcessingModule(), |
There was a problem hiding this comment.
DumpSegment needs this stuff?
There was a problem hiding this comment.
Yes, DumpSegment makes a segmentMetadata query!
| protected List<? extends Module> getModules() | ||
| { | ||
| return ImmutableList.<Module>of( | ||
| new DruidProcessingModule(), |
There was a problem hiding this comment.
InsertSegment needs this stuff?
There was a problem hiding this comment.
I don't know, but since CreateTables and DumpSegment weirdly depend on this stuff, and we don't test InsertSegment at all (neither from unit tests nor integration tests), I decided to include everything, not to break it occasionally. The same for ResetCluster, ValidateSegments and DruidJsonValidator.
There was a problem hiding this comment.
Sounds good. Perhaps include a comment that we're not sure if these are actually needed or not.
| protected List<? extends Module> getModules() | ||
| { | ||
| return ImmutableList.<Module>of( | ||
| new DruidProcessingModule(), |
There was a problem hiding this comment.
ResetCluster needs this stuff?
| protected List<? extends Module> getModules() | ||
| { | ||
| return ImmutableList.of( | ||
| new DruidProcessingModule(), |
There was a problem hiding this comment.
ValidateSegments needs this stuff?
| protected List<? extends com.google.inject.Module> getModules() | ||
| { | ||
| return ImmutableList.<com.google.inject.Module>of( | ||
| new DruidProcessingModule(), |
There was a problem hiding this comment.
DruidJsonValidator needs this stuff?
|
|
||
| public static final int BUFFER_SIZE = 0x10000; | ||
| private static final StupidPool<BufferRecycler> bufferRecyclerPool = new StupidPool<BufferRecycler>( | ||
| private static final NonBlockingPool<com.ning.compress.BufferRecycler> bufferRecyclerPool = new StupidPool<BufferRecycler>( |
There was a problem hiding this comment.
could you please remove com.ning.compress
|
|
||
| public interface NonBlockingPool<T> | ||
| { | ||
| ResourceHolder<T> take(); |
There was a problem hiding this comment.
Should NonBlockingPool and BlockingPool extend some common interface like ResourcePool?
There was a problem hiding this comment.
I don't see the point. BlockingPool could extend NonBlockingPool but it would look surprising. Also it may create problems with DI
drcrallen
left a comment
There was a problem hiding this comment.
Looks cool! Changing around the module injection order can change the lifecycle ordering through. As such this probably needs good testing internally to make sure the different instance types can all run with this change.
The integration tests, at least, check it for the major types. |
|
Moved into 0.10.1 as discussed in the dev sync |
…sing resources on Router (apache#4429) * Remove DruidProcessingModule, QueryableModule and QueryRunnerFactoryModule from DI for coordinator, overlord, middle-manager. Add RouterDruidProcessing not to allocate processing resources on router * Fix examples * Fixes * Revert Peon configs and add comments * Remove qualifier
…sing resources on Router (#4429) (#4478) * Remove DruidProcessingModule, QueryableModule and QueryRunnerFactoryModule from DI for coordinator, overlord, middle-manager. Add RouterDruidProcessing not to allocate processing resources on router * Fix examples * Fixes * Revert Peon configs and add comments * Remove qualifier
DruidProcessingModule,QueryableModuleandQueryRunnerFactoryModulefrom DI for coordinator, overlord, middle-manager.The same goal as in #4410.