neitomic / doh-server

An implementation of DNS server which supports DNS over HTTPS
1 stars 1 forks source link

feat: switch to tokio async udp socket #15

Closed neitomic closed 6 days ago

sonhmai commented 6 days ago

this solves the hanging issue?

neitomic commented 6 days ago

this solves the hanging issue?

not sure, just trying. Need to test first

sonhmai commented 6 days ago

looks like it does. at least I got some 480 Request Timeout without hanging so far ;)

make bench
Benchmarking A records
Running 30s test @ https://localhost/dns-query
  4 threads and 10 connections
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     5.11ms    4.13ms 129.04ms   84.47%
    Req/Sec   349.31     90.20   464.00     88.06%
  17981 requests in 30.06s, 5.70MB read
  Socket errors: connect 0, read 0, write 0, timeout 15
  Non-2xx or 3xx responses: 15
Requests/sec:    598.23
Transfer/sec:    194.10KB
------------------------------
Total Requests: 17981
Avg. Latency: 5.108 ms
Max Latency: 129.043 ms
50th percentile: 5.247 ms
90th percentile: 7.813 ms
99th percentile: 12.893 ms
------------------------------
Benchmarking AAAA records
Running 30s test @ https://localhost/dns-query
  4 threads and 10 connections
Error: 408
Error: 408
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     4.93ms    3.06ms 119.81ms   70.92%
    Req/Sec   363.85     94.29   600.00     66.50%
  43566 requests in 30.08s, 13.84MB read
  Socket errors: connect 0, read 0, write 0, timeout 2
  Non-2xx or 3xx responses: 2
Requests/sec:   1448.28
Transfer/sec:    471.28KB
------------------------------
Total Requests: 43566
Avg. Latency: 4.927 ms
Max Latency: 119.808 ms
50th percentile: 5.357 ms
90th percentile: 7.916 ms
99th percentile: 12.072 ms
------------------------------
neitomic commented 6 days ago

yeah, it does!

neitomic commented 6 days ago

looks like it does. at least I got some 480 Request Timeout without hanging so far ;)

make bench
Benchmarking A records
Running 30s test @ https://localhost/dns-query
  4 threads and 10 connections
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
Error: 408
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     5.11ms    4.13ms 129.04ms   84.47%
    Req/Sec   349.31     90.20   464.00     88.06%
  17981 requests in 30.06s, 5.70MB read
  Socket errors: connect 0, read 0, write 0, timeout 15
  Non-2xx or 3xx responses: 15
Requests/sec:    598.23
Transfer/sec:    194.10KB
------------------------------
Total Requests: 17981
Avg. Latency: 5.108 ms
Max Latency: 129.043 ms
50th percentile: 5.247 ms
90th percentile: 7.813 ms
99th percentile: 12.893 ms
------------------------------
Benchmarking AAAA records
Running 30s test @ https://localhost/dns-query
  4 threads and 10 connections
Error: 408
Error: 408
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     4.93ms    3.06ms 119.81ms   70.92%
    Req/Sec   363.85     94.29   600.00     66.50%
  43566 requests in 30.08s, 13.84MB read
  Socket errors: connect 0, read 0, write 0, timeout 2
  Non-2xx or 3xx responses: 2
Requests/sec:   1448.28
Transfer/sec:    471.28KB
------------------------------
Total Requests: 43566
Avg. Latency: 4.927 ms
Max Latency: 119.808 ms
50th percentile: 5.357 ms
90th percentile: 7.916 ms
99th percentile: 12.072 ms
------------------------------

Response time is good eh?

sonhmai commented 6 days ago

Response time is good eh?

Yes, I think it's good for now. We can use it as a baseline to improve later :D.

Regarding the throughput, if there is too many 408 throughput drops like below only 176 requests in 30s. we can probably implement an early timeout instead of waiting for the default timeout as an improvement later 😁

  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    12.62ms   20.57ms 122.74ms   89.61%
    Req/Sec    26.16     25.31    80.00     59.38%
  176 requests in 30.09s, 50.76KB read
  Socket errors: connect 0, read 0, write 0, timeout 22
  Non-2xx or 3xx responses: 22
Requests/sec:      5.85
Transfer/sec:      1.69KB
------------------------------
Total Requests: 176
Avg. Latency: 12.618 ms
Max Latency: 122.741 ms
50th percentile: 5.741 ms
90th percentile: 36.813 ms
99th percentile: 119.865 ms
------------------------------
neitomic commented 6 days ago

shall we merge this?

sonhmai commented 6 days ago

shall we merge this?

yes, let's go for an instant gratification on a Sat morning 🤣 🥇 . this should solve #12