Evaluate using Profile-Guided Optimization (PGO) and Post-Link Optimization (PLO) #1463
Replies: 1 comment
-
Hi @zamazan4ik, Thanks for the suggestion. We're aware that PGO is a thing, and we'll probably look into it eventually, but it isn't a priority in the near term. Using PGO correctly is challenging, since we'd need to collect representative profiles to drive the optimizer. In an ideal world we'd have some sort of automated load test we could run in CI which emulates production traffic so we could generate a new profile before every release and optimize based on that. Of course, creating such a representative test suite is essentially impossible without capturing real applications and real data from the wild, which would be problematic. The more realistic approach would be to capture profiles directly from production. But that's a capability we'd have to build, it's by no means trivial. We'd need an automated system to refresh these profiles so they're always up to date, etc. And we'd need to make sure we understand all the implications of using profiles that were generated based on a slightly older version of the code than the one we're optimizing. This is all a lot of work, and not something we feel is the best cost/benefit for our limited engineering hours right now. Maybe someday! |
Beta Was this translation helpful? Give feedback.
-
Hi!
Recently I checked Profile-Guided Optimization (PGO) and Post-Link Optimization (PLO) improvements on multiple projects. The results are available here. According to the tests, these optimizations can help with achieving better performance in many cases for many applications: networking apps like HAproxy and Envoy, many databases, parsing utilities like Vector, runtimes like V8, etc. Since this, I think trying to optimize workerd with PGO and PLO can be a good idea. According to the issue some people are already interested in further workerd optimization.
I can suggest the following action points:
Testing Post-Link Optimization techniques (like LLVM BOLT) would be interesting too (Clang and Rustc already use BOLT as an addition to PGO) but I recommend starting from the usual PGO.
Examples of how PGO optimization is integrated into other projects:
configure
scriptI have some examples of how PGO information looks in the documentation:
Regarding LLVM BOLT integration, I have the following examples:
I hope these ideas could be interesting for someone from the workerd community.
Beta Was this translation helpful? Give feedback.
All reactions