mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 02:05:30 +00:00
aquatic_http_load_test: add glommio implementation
This commit is contained in:
parent
e79a8c7e68
commit
13d18bbf03
6 changed files with 347 additions and 6 deletions
|
|
@ -1,12 +1,16 @@
|
|||
use std::fs::File;
|
||||
use std::io::BufReader;
|
||||
use std::sync::{atomic::Ordering, Arc};
|
||||
use std::thread;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use ::glommio::LocalExecutorBuilder;
|
||||
use rand::prelude::*;
|
||||
use rand_distr::Pareto;
|
||||
|
||||
mod common;
|
||||
mod config;
|
||||
mod glommio;
|
||||
mod network;
|
||||
mod utils;
|
||||
|
||||
|
|
@ -53,11 +57,16 @@ fn run(config: Config) -> ::anyhow::Result<()> {
|
|||
|
||||
// Start socket workers
|
||||
|
||||
let tls_config = create_tls_config().unwrap();
|
||||
|
||||
for _ in 0..config.num_workers {
|
||||
let config = config.clone();
|
||||
let tls_config = tls_config.clone();
|
||||
let state = state.clone();
|
||||
|
||||
thread::spawn(move || run_socket_thread(&config, state, 1));
|
||||
LocalExecutorBuilder::default().spawn(|| async move {
|
||||
glommio::run_socket_thread(config, tls_config, state).await.unwrap();
|
||||
}).unwrap();
|
||||
}
|
||||
|
||||
monitor_statistics(state, &config);
|
||||
|
|
@ -65,6 +74,33 @@ fn run(config: Config) -> ::anyhow::Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
struct FakeCertificateVerifier;
|
||||
|
||||
impl rustls::client::ServerCertVerifier for FakeCertificateVerifier {
|
||||
fn verify_server_cert(
|
||||
&self,
|
||||
_end_entity: &rustls::Certificate,
|
||||
_intermediates: &[rustls::Certificate],
|
||||
_server_name: &rustls::ServerName,
|
||||
_scts: &mut dyn Iterator<Item = &[u8]>,
|
||||
_ocsp_response: &[u8],
|
||||
_now: std::time::SystemTime,
|
||||
) -> Result<rustls::client::ServerCertVerified, rustls::Error> {
|
||||
Ok(rustls::client::ServerCertVerified::assertion())
|
||||
}
|
||||
}
|
||||
|
||||
fn create_tls_config() -> anyhow::Result<Arc<rustls::ClientConfig>> {
|
||||
let mut config = rustls::ClientConfig::builder()
|
||||
.with_safe_defaults()
|
||||
.with_root_certificates(rustls::RootCertStore::empty())
|
||||
.with_no_client_auth();
|
||||
|
||||
config.dangerous().set_certificate_verifier(Arc::new(FakeCertificateVerifier));
|
||||
|
||||
Ok(Arc::new(config))
|
||||
}
|
||||
|
||||
fn monitor_statistics(state: LoadTestState, config: &Config) {
|
||||
let start_time = Instant::now();
|
||||
let mut report_avg_response_vec: Vec<f64> = Vec::new();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue