INNER CODE UNIT · Rust

handle_benchmark

cloudflare/workers-rs · benchmark/src/lib.rs:33

async fn handle_benchmark(url: &Url) -> Result<Response> {
    // Get the base URL from the request
    let base_url = format!(
        "{}://{}",
        url.scheme(),
        url.host_str().unwrap_or("localhost")
    );
    let stream_url = format!("{base_url}/stream");

    // Create 10 parallel sub-requests
    let mut tasks = Vec::new();

    for i in 0..10 {
        let stream_url = stream_url.clone();

        // Create a task for each sub-request
        let task = async move {
            // Make the sub-request to the streaming endpoint

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…