manticoresoftware / manticoresearch

Easy to use open source fast database for search | Good alternative to Elasticsearch now | Drop-in replacement for E in the ELK soon
https://manticoresearch.com
GNU General Public License v3.0
9.09k stars 510 forks source link

Test Profile-Guided Optimization (PGO) #1247

Open zamazan4ik opened 1 year ago

zamazan4ik commented 1 year ago

Is your feature request related to a problem? Please describe. Not a problem - just an idea of how to (possibly) improve ManticoreSearch performance.

Describe the solution you'd like Recently I did a lot of testing Profile-Guided Optimization (PGO) on different kinds of software (including databases). Results you can check here.

I think the same tests should be performed on ManticoreSearch as well since it can improve the performance of the solution. Would be interesting to see the results.

Describe alternatives you've considered Leave things as is and do nothing :)

tomatolog commented 1 year ago

Could you use Docker container to build PGO build first then use PGO result to create optimized build?

As PGO has the meaning for the particular usage pattern and in case daemon load is the same. That means the user should create optimized build that suits only his needs.

zamazan4ik commented 1 year ago

Could you use Docker container to build PGO build first then use PGO result to create optimized build?

Yes, it's possible to use Docker'ized toolchain for doing PGO (via Instrumentation mode).

As PGO has the meaning for the particular usage pattern and in case daemon load is the same. That means the user should create optimized build that suits only his needs.

In general - yes. However, in some cases, it's possible to prepare a "generic enough" workload and use it to optimize delivered to the users' binaries. E.g. in this way, PGO works in Chrome, Firefox, CPython, Rustc.

tomatolog commented 1 year ago

I think there are different usage scenarios:

not sure that all these could be improved in generic case as even switch from GCC to Clang build cause change of performance.

zamazan4ik commented 1 year ago

At least you can try to collect a profile from all these modes, then merge the profiles (via llvm-profdata in the case of Clang), use it during the compilation, and measure the performance compared to the "vanilla" build.

Another option (from which I personally recommend starting) is trying to measure PGO benefits in some scenarios. And if PGO shows something interesting - put a note about PGO into the documentation somewhere in the section "Performance tuning". So ManticoreSearch users will know one more way, how to optimize performance if they are ready to recompile ManticoreSearch.

tomatolog commented 1 year ago

I think this is the excellent task for the community to collect PGO statistics for the section about "Performance tuning"