-
Notifications
You must be signed in to change notification settings - Fork 42
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
Optimize the rust builder image #152
Comments
this issue was obfuscated by overrides done in shell scripts. I opened #153 to hopefully save the next person from a similar fate. Regardless, there's likely use looking to pre-seed the image itself, as caching like this is complex and hides the poor execution time end users will perceive. That is assuming the runs are faster after some sort of seed operation. Another option could be to consider the normal rust sdk to see if it is better optimized, as there's likely some large effort maintaining a fork and also optimizing it https://github.com/proxy-wasm/proxy-wasm-rust-sdk |
Before, end-to-end test executions were very slow. Originally, there was only one extension language. When this changed, the e2e tests took longer than before, and there was no quick way to run all tests when only changing one language. This is because the test case managed the matrix of extension language. The change here is to pull the extension language out to a different ENV variable: `E2E_EXTENSION_LANGUAGE`. CI now manages this externally, which allows quick identification of errors or performance issues on a per-language basis. It also increases the incentive to run `make e2e`, by removing the "language I'm not using" penalty. It is understood that currently end-to-end tests happen to only test extensions and that this optimizes for the current codebase, not a future one that may have other matrix concerns. If such a topic happens later, we can consider alternate approaches, and meanwhile enjoy the isolation. See #152 Signed-off-by: Adrian Cole <adrian@tetrate.io>
@lizan FWIW here's what's going on per latest run: grep Finished 3_Run\ e2e\ tests\ \(macos-latest\,\ rust\).txt
2021-04-21T23:15:33.2248320Z Finished dev [unoptimized + debuginfo] target(s) in 1m 52s
2021-04-21T23:17:18.6423800Z Finished dev [unoptimized + debuginfo] target(s) in 22.57s
2021-04-21T23:19:07.5972280Z Finished dev [unoptimized + debuginfo] target(s) in 21.44s
2021-04-21T23:22:07.5313240Z Finished dev [unoptimized + debuginfo] target(s) in 22.18s
2021-04-21T23:23:55.2104940Z Finished dev [unoptimized + debuginfo] target(s) in 21.23s
2021-04-21T23:25:45.9745390Z Finished dev [unoptimized + debuginfo] target(s) in 20.94s
2021-04-21T23:35:36.7062050Z Finished test [unoptimized + debuginfo] target(s) in 8m 30s
2021-04-21T23:43:43.4438180Z Finished test [unoptimized + debuginfo] target(s) in 7m 51s
2021-04-21T23:51:39.2929100Z Finished test [unoptimized + debuginfo] target(s) in 7m 43s The good news is that the performance is consistent, it isn't degrading or anything. The other good news is that a huge amount of it could be fixed by improving the test execution or dependencies implied. Pardon the below as we intentionally allow colorized output.
What you'll notice is even though our test is trivial (pasted below) the setup for it is extremely costly in terms of time. use envoy::extension::{entrypoint, Module, Result};
use envoy_sample_http_filter::SampleHttpFilterFactory;
// Generate the `_start` function that will be called by `Envoy` to let
// WebAssembly module initialize itself.
entrypoint! { initialize }
/// Does one-time initialization.
///
/// Returns a registry of extensions provided by this module.
fn initialize() -> Result<Module> {
Module::new().add_http_filter(|_instance_id| SampleHttpFilterFactory::default())
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn should_initialize() {
assert!(initialize().is_ok());
}
} While I'm new at rust, I did notice the crate-type is not the same in top-level (rlib) vs the wasm/module (cdylib). When swimming through rust compile optimization blogs I did notice mention that dynamic libs reduce work involved https://doc.rust-lang.org/reference/linkage.html Hope the breadcrumbs help |
obviated by #200 |
Currently, "envoy extension build" on rust matrices are extremely slow. This hurts the dev experience and ties up CI and/or requiring careful consideration of external caches.
Here's a run from a latest macbook pro
While some of this is unavoidable, I think our builder image hasn't been optimized and there are possibly many things to look at here.
One that could be handy is to use the somewhat typical "first run" inside the Dockerfile. Running a baseline command inside docker can insure users of the image don't need to do a lot of excessive downloading. This could be a cargo command.
Again, I'm not sure what the best change should be, but some analysis should happen because the status quo bleeds dev time.
The text was updated successfully, but these errors were encountered: