There doesn't appear to be much of a meaningful performance difference between the await and .then implementations in this situation, but it does make it a little bit easier to chain error handling onto the handlers just to make this a little bit more hardened to crashes.
A sidenote: did some load testing and with this current implementation, I was able to benchmark locally with a wildcard query generator using Locust. QPS was ~2600 peak, but with only 40% utilization on 1CPU/1GB before my computer stopped being able to support Locust's efforts to generate queries.
Will clearly require some more robust load testing infrastructure.
Dockerfile Update:
Dockerfile: Changed the CMD directive to use dist/index.js instead of dist/bundle.js to reflect the correct entry point for the application.
Error Handling Improvements:
src/common/network/tcp.ts: Enhanced error handling in the DNSOverTCP class by adding .catch for promise rejections and a new error event listener on the socket to log errors and ensure the socket is properly closed.
src/common/network/udp.ts: Improved error handling in the DNSOverUDP class by adding .catch for promise rejections and a new error event listener on the server to log errors.
There doesn't appear to be much of a meaningful performance difference between the
await
and.then
implementations in this situation, but it does make it a little bit easier to chain error handling onto the handlers just to make this a little bit more hardened to crashes.A sidenote: did some load testing and with this current implementation, I was able to benchmark locally with a wildcard query generator using Locust. QPS was ~2600 peak, but with only 40% utilization on 1CPU/1GB before my computer stopped being able to support Locust's efforts to generate queries.
Will clearly require some more robust load testing infrastructure.
Dockerfile Update:
Dockerfile
: Changed theCMD
directive to usedist/index.js
instead ofdist/bundle.js
to reflect the correct entry point for the application.Error Handling Improvements:
src/common/network/tcp.ts
: Enhanced error handling in theDNSOverTCP
class by adding.catch
for promise rejections and a newerror
event listener on the socket to log errors and ensure the socket is properly closed.src/common/network/udp.ts
: Improved error handling in theDNSOverUDP
class by adding.catch
for promise rejections and a newerror
event listener on the server to log errors.