我使用Drill在MongoDB后端运行SQL。我的响应时间约为500毫秒。但大部分时间都花在“第一次开始”阶段。钻取的实际处理花费的时间少得多(约50ms)。为什么“第一次开始”花了这么多时间?我想知道在那个阶段做什么钻,如果可能的话,优化它。
在第一个查询之后,Drill会创建大量缓存对象以改进其他工作,有关详细信息,请参阅Generated Code Cache
[1],[2],[3],StoragePluginRegistry
Cache [4]。此外,MongoSchemaFactory
为你的database
和tableName
[5]创建缓存,该缓存在1分钟后到期。
如果您尝试执行查询,当缓存过期时,您很可能会获得相似的时间。
[1] https://github.com/paul-rogers/drill/wiki/CG-Code-Cache [2] https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ByteCodeLoader.java#L36 [3] https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/compile/CodeCompiler.java#L145 [4] https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java#L90 [5] https://github.com/apache/drill/blob/master/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/schema/MongoSchemaFactory.java#L66