Tortuga
Tortuga is an HTTP CGI-specific server written in Rust.
Badges
Book
For design goals, non-goals and more see the Tortuga Web Server Book.
RFC
This project attempts to implement the CGI RFC.
Testing
Local Install
To test the command-line interface, install the crate locally from the root of the repository with:
cargo install --path ./
Cargo Tests
To run the unit and documentation tests, use:
cargo test
Endianness
While the system sends all numbers in network byte order (i.e., big endian), WebAssembly uses little-endian for its numbers. Therefore, the system will handle mapping the integers between the types of endianness. See https://tools.ietf.org/html/draft-newman-network-byte-order-01
Examples
Some basic CGI programs can be found in the /examples directory.
Versioning
Tortuga adheres to Semantic Versioning. You can use tortuga version
or tortuga -V
to determine the version of a Tortuga installation.
Benchmark
All benchmarking code was run on a 16-core Codespace with the default image. Apache was installed using the apt
package and wrk
was installed by building from source.
Apache
Configured Apache to serve the debug.cgi script using the default configuration to get a baseline for the performance we want to aim for without much load.
Script:
Output:
#[Mean = 78.119, StdDeviation = 2.294]
#[Max = 97.984, Total count = 400]
#[Buckets = 27, SubBuckets = 2048]
)
#[Mean = 2.886, StdDeviation = 0.632]
#[Max = 5.856, Total count = 6795]
#[Buckets = 27, SubBuckets = 2048]
)
Test without server
Running the empty.cgi script without an HTTP server takes about 5 milliseconds. Therefore, we will not be able to do much better than half that time (since the test command starts 2 processes). Apache takes approximately 3 milliseconds on an empty CGI script, so there is very little overhead.
cargo build --release
time target/release/tortuga test -s examples/debug.cgi
CGI versus WCGI
On a 4-core Intel CPU, I ran the following quick benchmarks:
WCGI without Compilation Cache
The initial compilation slows down the first request.
WCGI with Compilation Cache
The cache is enabled by pointing the server at a file created via wasmtime config new
.
CGI
Static File