Latest commit serves roughly 259k requests per second on not-so-new hardware (AMD Ryzen 5 2600x 2.2GHz). But latest zig (0.13.0-dev.211+6a65561e3) takes more than 35 seconds to build (with a 24 file, 240k web site). It stays a long time on “Semantic Analysis”.
If you decide to change the operation mode.
splice for zero copy from/to pipes is also available.
You can implement sendfile
by creating a pipe and queuing two splices, the first splice from file fd to the write fd of pipe, and the second splice from the read fd of pipe to the socket, like:
const fds = try std.posix.pipe();
_ = try ring.splice(user_data, read_file, 0, fds[1], 0, file_size);
_ = try ring.splice(user_data, fds[0], 0, send_socket, 0, file_size);
2 Likes
Yeah I’m thinking on making a “normal” version of this server that actually serves files instead of pre-processing them and serving from memory as subzed
currently does. In the file serving version, this splice method will come in handy, thanks.