Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any suggestions about setting gengine pool parameters poolMinLen, poolMaxLen #19

Open
shiqstone opened this issue Dec 18, 2020 · 3 comments
Labels
good first issue Good for newcomers

Comments

@shiqstone
Copy link

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.

@rencalo770
Copy link
Owner

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

@shiqstone
Copy link
Author

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.

@rencalo770
Copy link
Owner

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

  1. Computer resource limit (CPU/ memory)
  2. How many rules in gengine and the execute mode you choosed(so we supply many execute modes in gengine and gengine pool, just for support users to choose the most suitable execute mode to use in their own business )
  3. Your application type( CPU intensive or I/O intensive )

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

@rencalo770 rencalo770 added the good first issue Good for newcomers label Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants