问题描述
我正在使用 Drill 在 MongoDB 后端运行 SQL.我的响应时间约为 500 毫秒.但大部分时间都花在首次启动"阶段.钻探中的实际处理时间要少得多(~50ms).为什么第一次开始"需要这么多时间?我想知道在该阶段进行了哪些练习,并在可能的情况下对其进行优化.
I am running SQL on MongoDB backend using Drill. I am getting response time ~500ms. But most of that time is spent on "First start" phase. Actual processing in drill is taking much less time(~50ms). Why does "First start" take so much time? I would like to know what drill in doing in that phase and if possible optimise that.
推荐答案
在第一次查询后 Drill 创建了很多缓存对象以改进进一步的工作,参见 Generated Code Cache
[1], [2], [3] 详情,StoragePluginRegistry
缓存 [4].此外,MongoSchemaFactory
会为您的 database
和 tableName
[5] 创建缓存,缓存会在 1 分钟后过期.
After the first query Drill creates a lot of cache objects to improve the further work, see Generated Code Cache
[1], [2], [3] for details, StoragePluginRegistry
Cache [4].Also MongoSchemaFactory
creates cache for your database
and tableName
[5], which expires after 1 minute.
如果您尝试执行查询,很可能会在缓存过期时获得相似的时间.
Most likely you will get the similar time, if you try to execute your query, when the cache expires.
[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
这篇关于Apache Drill - 首次启动时间很长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!