Getting Started with G-WAN: Installation, Configuration, and Benchmarks
Overview
- G-WAN is a lightweight, high-performance web server focused on low latency and low memory usage. It supports C/C++ servlets and aims for minimal footprint and maximal throughput.
Installation (Linux x86_64 assumed)
- Download the latest G-WAN binary for Linux from the official distribution (assume tar.gz).
- Extract:
tar -xzf gwan-.tar.gz - Move the gwan directory to /opt/gwan (or /usr/local/gwan) and set executable permissions:
sudo mv gwan /opt/gwansudo chmod -R 755 /opt/gwan - Start the server:
cd /opt/gwansudo ./gwan - Verify by visiting http://localhost:8080 (default port) or checking process with ps.
Configuration
- Main config file: conf/gwan.conf (or conf/gwan), edit to change:
- port (default 8080)
- document root
- worker threads / processes
- logging and access controls
- Virtual hosts: place site folders under the web/ directory; each folder becomes a vhost.
- Servlets: put C/C++ servlets in web//servlets/ and scripts in web//handlers/.
- TLS: place certificate and key in conf/ and enable TLS settings in config.
Basic Tuning Tips
- Set worker count to match CPU cores for best throughput.
- Use keep-alive and appropriate timeouts to balance resource usage.
- Enable sendfile and avoid unnecessary logging in benchmarks.
- Use optimized C servlets for CPU-bound work; static files are extremely fast.
Benchmarks (how to run)
- Use a load tester (wrk, ab, or hey). Example with wrk:
wrk -t12 -c400 -d30s http://localhost:8080/ - Measure baseline with static file, then with a simple C servlet to compare dynamic handling.
- Record requests/sec, latency percentiles (50/95/99), and error rates.
Interpreting Results
- High requests/sec with low p99 latency indicates good throughput.
- If latency or errors rise with concurrency, increase workers or tune OS network settings (ulimit, tcp_tw_reuse, net.core.somaxconn).
- Compare to Nginx/Apache using identical hardware and workloads for fair comparison.
Example Minimal Setup (summary)
- Install binary to /opt/gwan
- Start server on default port 8080
- Put static files in web/root/
- Run wrk against http://localhost:8080/ and tune worker threads = CPU cores
Further Resources
- Official docs and examples shipped with the G-WAN download contain servlets and configuration examples.
May 15, 2026
Leave a Reply