cube.js 调度&&查询队参考参数
参考参数
packages/cubejs-query-orchestrator/src/orchestrator/QueryQueue.js
- 构造函数
constructor(redisQueuePrefix, options) {
this.redisQueuePrefix = redisQueuePrefix;
this.concurrency = options.concurrency || 2;
this.continueWaitTimeout = options.continueWaitTimeout || 5;
this.executionTimeout = options.executionTimeout || 600;
this.orphanedTimeout = options.orphanedTimeout || 120;
this.heartBeatInterval = options.heartBeatInterval || 30;
this.sendProcessMessageFn = options.sendProcessMessageFn || ((queryKey) => { this.processQuery(queryKey); });
this.sendCancelMessageFn = options.sendCancelMessageFn || ((query) => { this.processCancel(query); });
this.queryHandlers = options.queryHandlers;
this.cancelHandlers = options.cancelHandlers;
this.logger = options.logger || ((message, event) => console.log(`${message} ${JSON.stringify(event)}`));
const queueDriverOptions = {
redisQueuePrefix: this.redisQueuePrefix,
concurrency: this.concurrency,
continueWaitTimeout: this.continueWaitTimeout,
orphanedTimeout: this.orphanedTimeout,
heartBeatTimeout: this.heartBeatInterval * 4,
redisPool: options.redisPool
};
this.queueDriver = options.cacheAndQueueDriver === 'redis' ?
new RedisQueueDriver(queueDriverOptions) :
new LocalQueueDriver(queueDriverOptions);
}
packages/cubejs-query-orchestrator/src/orchestrator/QueryCache.ts
参考构造函数
public constructor(
protected readonly redisPrefix: string,
protected readonly driverFactory: DriverFactoryByDataSource,
protected readonly logger: any,
protected readonly options: {
refreshKeyRenewalThreshold?: number;
externalQueueOptions?: any;
externalDriverFactory?: DriverFactory;
backgroundRenew?: Boolean;
queueOptions?: object | ((dataSource: String) => object);
redisPool?: any;
continueWaitTimeout?: number;
cacheAndQueueDriver?: 'redis' | 'memory';
maxInMemoryCacheEntries?: number;
} = {}
) {
this.cacheDriver = options.cacheAndQueueDriver === 'redis' ?
new RedisCacheDriver({ pool: options.redisPool }) :
new LocalCacheDriver();
this.memoryCache = new LRUCache<string, CacheEntry>({
max: options.maxInMemoryCacheEntries || 10000
});
}
参考配置
- 调度
edisPrefix Prefix to be set an all Redis keys STANDALONE
rollupOnlyMode When enabled, an error will be thrown if a query can't be served from a pre-aggregation (rollup) false
queryCacheOptions Query cache options for DB queries {}
queryCacheOptions.refreshKeyRenewalThreshold Time in seconds to cache the result of refreshKey check defined by DB dialect
queryCacheOptions.backgroundRenew Controls whether to wait in foreground for refreshed query data if refreshKey value has been changed. Refresh key queries or pre-aggregations are never awaited in foreground and always processed in background unless cache is empty. If true it immediately returns values from cache if available without refreshKey check to renew in foreground. Default value before 0.15.0 was true false
queryCacheOptions.queueOptions Query queue options for DB queries {}
preAggregationsOptions Query cache options for pre-aggregations {}
preAggregationsOptions.queueOptions Query queue options for pre-aggregations {}
preAggregationsOptions.externalRefresh When running a separate instance of Cube.js to refresh pre-aggregations in the background, this option can be set on the API instance to prevent it from trying to check for rollup data being current - it won't try to create or refresh them when this option is true
- 查询
concurrency Maximum number of queries to be processed simultaneosly. For drivers with connection pool CUBEJS_DB_MAX_POOL should be adjusted accordingly. 2
continueWaitTimeout Long polling interval 5
executionTimeout Total timeout of single query 600
orphanedTimeout Query will be marked for cancellation if not requested during this period. 120
heartBeatInterval Worker heartbeat interval. If 4*heartBeatInterval time passes without reporting, the query gets cancelled. 30
说明
以上配置来自官方文档以及代码,实际使用还是比较有用的,对于一些部署中的优化很重要,有些参数可能官方文档没有提供,但是通过代码可以查看了解
参考资料
https://cube.dev/docs/config#options-reference-orchestrator-options
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2020-04-22 How We Spotted and Fixed a Performance Degradation in Our Python Code
2020-04-22 nodejs 基础镜像的一个参考
2020-04-22 几款不错的基于web 的sql编辑器
2019-04-22 python 集成cython 简单测试
2019-04-22 click python cli 开发包
2014-04-22 asp.net excel 操作
2014-04-22 gridview 自动序号 合计