Skip to content

"Too many open files" error when benchmarking #577

@zizhengtai

Description

@zizhengtai

I wanted to benchmark the example in the readme but got this Error: Os { code: 24, kind: Other, message: "Too many open files" } error.

  • macOS 10.15.5
  • 2.3 GHz 8-Core Intel Core i9 (16 logical cores)
  • rustc 1.44.0 (49cae5576 2020-06-01)
$ ulimit --all
Maximum size of core files created                           (kB, -c) 0
Maximum size of a process’s data segment                     (kB, -d) unlimited
Maximum size of files created by the shell                   (kB, -f) unlimited
Maximum size that may be locked into memory                  (kB, -l) unlimited
Maximum resident set size                                    (kB, -m) unlimited
Maximum number of open file descriptors                          (-n) 256
Maximum stack size                                           (kB, -s) 8192
Maximum amount of cpu time in seconds                   (seconds, -t) unlimited
Maximum number of processes available to a single user           (-u) 5568
Maximum amount of virtual memory available to the shell      (kB, -v) unlimited

Code:

use std::io;

#[async_std::main]
async fn main() -> io::Result<()> {
    let mut app = tide::new();
    app.at("/hello").get(|_| async { Ok("Hello, world!") });
    app.listen("127.0.0.1:8000").await?;
    Ok(())
}

Dependencies:

tide = "0.10.0"
async-std = { version = "1.6.0", features = ["attributes"] }

Tide command and output (same for both "/" and "/hello"):

$ cargo run --release
    Finished release [optimized] target(s) in 0.13s
     Running `target/release/test_tide`
Error: Os { code: 24, kind: Other, message: "Too many open files" }

wrk command and output for "/":

$ wrk -t10 -c1000 -d10s --latency http://127.0.0.1:8000
Running 10s test @ http://127.0.0.1:8000
  10 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     3.05ms    1.29ms   5.36ms   63.78%
    Req/Sec   380.00    229.91     0.85k    70.00%
  Latency Distribution
     50%    2.19ms
     75%    4.45ms
     90%    4.80ms
     99%    5.13ms
  392 requests in 10.07s, 31.39KB read
  Socket errors: connect 757, read 1702, write 8, timeout 0
  Non-2xx or 3xx responses: 392
Requests/sec:     38.91
Transfer/sec:      3.12KB

wrk command and output for "/hello":

$ wrk -t10 -c1000 -d10s --latency http://127.0.0.1:8000/hello
Running 10s test @ http://127.0.0.1:8000/hello
  10 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     3.19ms    1.53ms   7.90ms   86.61%
    Req/Sec   419.80    216.12   817.00     60.00%
  Latency Distribution
     50%    2.53ms
     75%    4.49ms
     90%    4.80ms
     99%    7.84ms
  433 requests in 10.06s, 54.55KB read
  Socket errors: connect 757, read 1521, write 22, timeout 0
Requests/sec:     43.05
Transfer/sec:      5.42KB

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions