-
Notifications
You must be signed in to change notification settings - Fork 11
Allow rpm test to run in non-tls mode #31
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ pub async fn run(url: String, runs: usize) -> anyhow::Result<()> { | |
| let result = run_test(&LatencyConfig { | ||
| url: url.parse()?, | ||
| runs, | ||
| no_tls: false, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use
|
||
| }) | ||
| .await?; | ||
|
|
||
|
|
@@ -48,6 +49,7 @@ pub async fn run_test(config: &LatencyConfig) -> anyhow::Result<LatencyResult> { | |
| let network = Arc::new(TokioNetwork::new( | ||
| Arc::clone(&time), | ||
| shutdown.clone(), | ||
| config.no_tls, | ||
| )) as Arc<dyn Network>; | ||
|
|
||
| let rtt = Latency::new(config.clone()); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,13 +55,18 @@ struct RpmReport { | |
|
|
||
| impl RpmReport { | ||
| pub fn from_rpm_result(result: &ResponsivenessResult) -> anyhow::Result<RpmReport> { | ||
| let throughput = result.throughput().context("no throughputs available")?; | ||
| let loaded_latency_ms = match result.self_probe_latencies.quantile(0.5).map(pretty_ms) { | ||
| Some(v) => v, | ||
| None => { | ||
| tracing::warn!("no loaded latency measurements; defaulting to 0ms"); | ||
| 0.0 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reporting a wrong value is not desirable. Could you keep it as an error? Or make the field an |
||
| } | ||
| }; | ||
|
|
||
| Ok(RpmReport { | ||
| throughput: result.throughput().context("no throughputs available")?, | ||
| loaded_latency_ms: result | ||
| .self_probe_latencies | ||
| .quantile(0.5) | ||
| .map(pretty_ms) | ||
| .context("no loaded latency measurements")?, | ||
| throughput, | ||
| loaded_latency_ms, | ||
| rpm: result.rpm as usize, | ||
| }) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,10 +25,11 @@ use crate::util::pretty_secs_to_ms; | |
| pub async fn run(cli_config: RpmArgs) -> anyhow::Result<()> { | ||
| info!("running responsiveness test"); | ||
|
|
||
| let rpm_urls = match cli_config.config.clone() { | ||
|
|
||
| let mut rpm_urls = match cli_config.config.clone() { | ||
| Some(endpoint) => { | ||
| info!("fetching configuration from {endpoint}"); | ||
| let urls = get_rpm_config(endpoint).await?.urls; | ||
| let urls = get_rpm_config(endpoint, cli_config.no_tls).await?.urls; | ||
| info!("retrieved configuration urls: {urls:?}"); | ||
|
|
||
| urls | ||
|
|
@@ -45,11 +46,41 @@ pub async fn run(cli_config: RpmArgs) -> anyhow::Result<()> { | |
| } | ||
| }; | ||
|
|
||
| // If --no-tls is specified, automatically convert provided HTTPS test URLs to HTTP. | ||
| // We only rewrite schemes; host, path, query, fragment remain unchanged. | ||
| if cli_config.no_tls { | ||
| let downgrade = |orig: &str| -> String { | ||
| if let Ok(mut url) = url::Url::parse(orig) { | ||
| if url.scheme() == "https" { | ||
| // Ignore result of set_scheme (fails only if new scheme invalid length per spec). | ||
| let _ = url.set_scheme("http"); | ||
| return url.to_string(); | ||
| } | ||
| } | ||
| orig.to_string() | ||
| }; | ||
|
|
||
| let original = rpm_urls.clone(); | ||
| rpm_urls.small_https_download_url = downgrade(&rpm_urls.small_https_download_url); | ||
| rpm_urls.large_https_download_url = downgrade(&rpm_urls.large_https_download_url); | ||
| rpm_urls.https_upload_url = downgrade(&rpm_urls.https_upload_url); | ||
| info!( | ||
| "converted urls for --no-tls: small: {} -> {}, large: {} -> {}, upload: {} -> {}", | ||
| original.small_https_download_url, | ||
| rpm_urls.small_https_download_url, | ||
| original.large_https_download_url, | ||
| rpm_urls.large_https_download_url, | ||
| original.https_upload_url, | ||
| rpm_urls.https_upload_url | ||
| ); | ||
| } | ||
|
|
||
| // first get unloaded RTT measurements | ||
| info!("determining unloaded latency"); | ||
| let rtt_result = crate::latency::run_test(&LatencyConfig { | ||
| url: rpm_urls.small_https_download_url.parse()?, | ||
| runs: 20, | ||
| no_tls: cli_config.no_tls, | ||
| }) | ||
| .await?; | ||
| info!( | ||
|
|
@@ -74,6 +105,7 @@ pub async fn run(cli_config: RpmArgs) -> anyhow::Result<()> { | |
| trimmed_mean_percent: cli_config.trimmed_mean_percent, | ||
| std_tolerance: cli_config.std_tolerance, | ||
| max_loaded_connections: cli_config.max_loaded_connections, | ||
| no_tls: cli_config.no_tls, | ||
| }; | ||
|
|
||
| info!("running download test"); | ||
|
|
@@ -120,6 +152,7 @@ async fn run_test( | |
| let network = Arc::new(TokioNetwork::new( | ||
| Arc::clone(&time), | ||
| shutdown.clone().into(), | ||
| config.no_tls, | ||
| )) as Arc<dyn Network>; | ||
|
|
||
| let rpm = Responsiveness::new(config.clone(), download)?; | ||
|
|
@@ -139,7 +172,7 @@ pub struct RpmServerConfig { | |
| urls: RpmUrls, | ||
| } | ||
|
|
||
| #[derive(Debug, Serialize, Deserialize)] | ||
| #[derive(Debug, Serialize, Deserialize, Clone)] | ||
| pub struct RpmUrls { | ||
| #[serde(alias = "small_download_url")] | ||
| small_https_download_url: String, | ||
|
|
@@ -149,16 +182,19 @@ pub struct RpmUrls { | |
| https_upload_url: String, | ||
| } | ||
|
|
||
| pub async fn get_rpm_config(config_url: String) -> anyhow::Result<RpmServerConfig> { | ||
| pub async fn get_rpm_config(config_url: String, no_tls: bool) -> anyhow::Result<RpmServerConfig> { | ||
| let shutdown = CancellationToken::new(); | ||
| let time = Arc::new(TokioTime::new()); | ||
| let network = Arc::new(TokioNetwork::new( | ||
| Arc::clone(&time) as Arc<dyn Time>, | ||
| shutdown.clone(), | ||
| no_tls, | ||
| )); | ||
|
|
||
| let conn_type = if no_tls { ConnectionType::H1 } else { ConnectionType::H2 }; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unencrypted H/2 theoretically exists, so this downgrade isn't obvious. Maybe the no_tls option could have a different name? or tls and h2 have their own options?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was having trouble with unencrypted http2 working with the cloudflare endopints. I'll try again, but @fisherdarling has agreed that might be the case
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I absolutely expect that unencrypted H/2 will be difficult to use. I'm mainly worried about H/1 vs H/2+TLS changing two variables at once, from UI perspective. In case somebody wanted to compare TLS overhead, it isn't apples to apples comparison. So the toggle could be just clearer about what changes, maybe Or if the two could be toggled separately, H/1+TLS would be a possibile option. |
||
| let response = Client::default() | ||
| .new_connection(ConnectionType::H2) | ||
| .plain_http_mode(no_tls) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| .new_connection(conn_type) | ||
| .method("GET") | ||
| .send( | ||
| config_url.parse().context("parsing rpm config url")?, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having both
no-anddisable-is inconsistent.no-is more typical for args, so maybe rename the other arg tono-aim-scoresand adddisable-aim-scoresas an alias for backwards compatibility?