A collection of simple RESTful applications implemented in different programming languages. The goal is to compare implementations side-by-side, focusing mainly on performance, but also on readability and ease of maintenance
- JSON serialization example
- PostgreSQL integration with read/write endpoints
- Redis caching with fallback logic
- Simulated concurrency endpoint
- Health check
- Graceful shutdown support
- Tech Stack
- Setup
- Endpoints
- Project Structure
- License
Each language may include one or more web frameworks with relevant libraries
- Frameworks:
- chi - HTTP router - Project repository
- Libraries:
- pgx - PostgreSQL driver
- go-redis - Redis client
- net/http - HTTP Server
- Frameworks:
- axum - Web framework - Project repository
- Libraries:
- tokio - Async runtime
- Frameworks:
- zap - HTTP Server - Project repository
- Frameworks:
- crow - Micro web framework - Project repository
- Docker
- Docker Compose
To build and run all implementations and supporting tool (eg. wrk for benchmarking), simply run:
docker-compose up -d --buildThis will:
- Build all language implementations automatically via their respective Dockerfiles
- Start services in isolated containers
- Start wrk for benchmarking
- Save the results in json form inside wrk-results
Note
Please make sure ports 8080-8083 on your machine are available
All implementations aim to expose the same set of endpoints:
| Method | Endpoint | Description |
|---|---|---|
| GET | /health |
Returns a simple health check response |
| GET | /user/json |
Returns a static user JSON |
| GET | /user/db/{id} |
Fetches a user from PostgreSQL |
| POST | /user/db |
Writes a new user to PostgreSQL |
| GET | /user/cache/{id} |
Fetches a user from Redis or falls back to PostgreSQL |
| GET | /user/concurrent |
Simulates concurrent access (delayed) |
{
"username": "alice",
"email": "alice@example.com"
}RestTest/
├── go/
│ └── chi/ # Go with chi framework
├── rust/
│ └── axum/ # Rust with axum
├── cpp/
│ └── crow/ # C++ with Crow
├── zig/
│ └── zap/ # Zig with Zap
├── wrk-scripts/ # Benchmarking scripts
├── wrk-results/ # JSON output from benchmarking
├── docker-compose.yml
└── README.mdAs you can see, each implementation follows this pattern: <Language>/<framework>/ (Note capitalization).
Inside each you will find:
- Source code - main, routes, handlers, db/cache logic
- Dockerfile - for container definition
Want to add a new language or framework? Follow the existing structure:
- Create a new folder under
<language>/<framework> - Implement the required endpoints with matching behavior
- Use a Dockerfile to build the service
- Update
docker-compose.ymlaccordingly - Provide your benchmarking scripts in wrk-scripts following the other scripts' behavior
PRs and issues for performance optimizations or project structure are also welcome!
This project is licensed under the MIT license. See LICENSE for details.