Open shiqstone opened 3 years ago
thanks for your issue! Commonly, we set the poolMaxLen based on this formula: poolMaxLen = (goroutine_wait_time / CPU_time + 1) CPU_core, but it may hard to understand, so in our business we set as follow: poolMinLen = poolMaxLen / 2, and poolMaxLen = cpu_core 5 to cpu_core * 10
Thanks for your help! I did some benchmarks, I ran some tests on the same case with different gengine pool conf, get some different performances result as follow, server is cpu 8 core / mem 16G
pool_min_len | pool_max_len | mean cost(s) |
---|---|---|
20 | 40 | 3.8608 |
20 | 80 | 2.2801 |
20 | 120 | 1.6815 |
20 | 160 | 1.6576 |
40 | 80 | 2.1702 |
40 | 120 | 1.6951 |
40 | 160 | 1.6611 |
40 | 200 | 1.6848 |
80 | 120 | 1.6937 |
80 | 160 | 1.6771 |
80 | 200 | 1.6729 |
80 | 240 | 1.6417 |
It seems that pool_min_len has little effect on performance. After pool_max_len configuration exceeds 160(cpu_core * 20), the performance improvement is no longer obvious. On the contrary, the larger the pool_max_len setting,the slower the engine loading.
I'm not sure about the result yet, I will do more test later.
Thanks for your detail test! Your test is acceptable that In certain range when you make the poolMaxLen bigger, the performance higher you get, and then when out of the range, bigger poolMaxLen will not improve the performance any more.
In fact, the execute performance is relations with many factors, mains are
The other is that "larger the pool_max_len setting,the slower the engine loading", because when the pool_max_len set larger, the pool will have to keep more gengine instances in it, so it will cost more time to load.
At last, for improve performance of the load gengine, gengine support Incrementally update the rules you will load into gengine, see function
//in rulebuilder
func (builder *RuleBuilder) BuildRuleWithIncremental(ruleString string) error
// in pool
func (gp *GenginePool) UpdatePooledRulesIncremental(ruleStr string) error
I am trying to figure out how to adjust the parameter configuration to improve performance, but I am not sure about the relationship between these parameters and the server configuration, and how they affect performance, please give me some suggestions, thanks.