This repository compares Docker image and container performance (image size, cold start time, warmup time, memory usage, CPU usage, etc.) across various languages and frameworks.
- GoLang (Go 1.21, Alpine-based)
- Node.js (Node 22, Alpine-based)
- Node.js TypeScript (Node 22 with TypeScript compilation, Alpine-based)
- Bun (Bun 1.x, Alpine-based)
- Deno (Deno 2.1.4)
Each implementation provides the same set of API endpoints for fair performance comparison.
docker-test/
├── golang/ # Go implementation (basic endpoints)
├── nodejs/ # Node.js implementation (basic endpoints)
├── nodejs-typescript/ # TypeScript implementation (basic endpoints)
├── bun/ # Bun implementation (basic endpoints)
├── deno/ # Deno implementation (basic endpoints)
├── golang-mongo/ # Go + MongoDB (raw driver) - Accounts Payable
├── golang-mongo-orm/ # Go + MongoDB + MGM ORM - Accounts Payable
├── nodejs-express-mongo/ # Node.js + Express + Mongoose - Accounts Payable
├── shared/ # Shared test data and DB init script
├── benchmark/ # Benchmark scripts
├── docker-compose.yml # Docker Compose for basic implementations
├── ACCOUNTS_PAYABLE.md # Accounts Payable implementations overview
├── QUICKSTART_AP.md # Quick start guide for AP implementations
└── *.sh # Helper scripts
All implementations provide these endpoints on port 8080:
GET /hello-world— Simple health check (cold start and minimal response time)POST /echo— Returns posted JSON/body (request parsing and JSON serialization)GET /compute— Fibonacci(30) calculation (CPU performance)GET /data— Returns 100 JSON objects (memory and network transfer)GET /file-read— Reads a static file (file I/O read performance)POST /file-write— Writes data to file (file I/O write performance)GET /db-read— Reads from PostgreSQL (database read performance)POST /db-write— Inserts into PostgreSQL (database write performance)
- Docker and Docker Compose
- curl (for testing)
- jq (optional, for pretty JSON output)
- bc (for benchmark calculations)
./build-all.shThis builds Docker images for all runtimes.
./run-all.shThis starts all containers and PostgreSQL. Services will be available at:
- GoLang: http://localhost:8081
- Node.js: http://localhost:8082
- TypeScript: http://localhost:8083
- Bun: http://localhost:8084
- Deno: http://localhost:8085
- PostgreSQL: localhost:5432
Test all endpoints for a specific runtime:
./test-endpoints.sh 8081 # Test GoLang
./test-endpoints.sh 8082 # Test Node.js
./test-endpoints.sh 8083 # Test TypeScript
./test-endpoints.sh 8084 # Test Bun
./test-endpoints.sh 8085 # Test Deno./benchmark/benchmark.shThis script measures:
- Image sizes (compressed and uncompressed)
- Cold start time (container restart to first response)
- Response times for each endpoint (10 requests average)
- Memory and CPU usage
- Load test (100 requests to /hello-world)
./stop-all.shdocker-compose build golang
docker-compose build nodejs
docker-compose build nodejs-typescript
docker-compose build bun
docker-compose build denodocker-compose up -d golang
docker-compose up -d nodejs
# etc.docker-compose logs -f golang
docker-compose logs -f nodejs
# etc.docker statscurl http://localhost:8081/hello-worldcurl -X POST http://localhost:8081/echo \
-H "Content-Type: application/json" \
-d '{"message":"test"}'curl http://localhost:8081/computecurl -X POST http://localhost:8081/db-write \
-H "Content-Type: application/json" \
-d '{"name":"Test Item","value":123}'curl http://localhost:8081/db-readThe benchmark script provides the following metrics:
- Image Size: Compressed and uncompressed Docker image sizes
- Cold Start Time: Time from container start to first successful response
- Response Time: Average, min, and max response times for each endpoint
- Memory Usage: Current memory consumption per container
- CPU Usage: CPU percentage per container
- Throughput: Requests per second under load
PostgreSQL is configured with:
- Host: postgres (via Docker network)
- Port: 5432
- Database: testdb
- User: testuser
- Password: testpass
The database is automatically initialized with a test_table containing sample data.
- All implementations use optimized production builds
- Multi-stage builds are used where applicable (Go, TypeScript)
- Alpine Linux base images minimize size
- Database connection retry logic ensures services start properly
- All endpoints implement consistent error handling
In addition to the basic endpoint comparisons, this repository includes three production-grade Accounts Payable implementations for real-world application benchmarking:
- Pure Go with official MongoDB driver
- Port: 8080 (app), 27017 (MongoDB)
- Features: Manual transactions, optimistic locking, production error handling
- Go with MGM (Mongo Go Models) ORM
- Port: 8081 (app), 27018 (MongoDB)
- Features: ORM benefits, automatic timestamps, cleaner code
- Node.js with Express and Mongoose ODM
- Port: 8082 (app), 27019 (MongoDB)
- Features: Schema validation, middleware hooks, rapid development
All three implementations include:
- Complete vendor management (CRUD)
- Full invoice lifecycle (draft → approved → paid)
- MongoDB transactions for payment processing
- Production-grade error handling and validation
- Business logic enforcement
- Graceful shutdown and health checks
Quick Start for AP Implementations:
# See detailed guides
cat ACCOUNTS_PAYABLE.md # Implementation comparison
cat QUICKSTART_AP.md # Quick start guide
# Run individual implementation
cd golang-mongo && docker-compose up --build
cd golang-mongo-orm && docker-compose up --build
cd nodejs-express-mongo && docker-compose up --buildRemove all containers and volumes:
docker-compose down -vRemove all images:
docker-compose down --rmi all -v# Stop and remove all AP implementations
docker-compose -f golang-mongo/docker-compose.yml down -v
docker-compose -f golang-mongo-orm/docker-compose.yml down -v
docker-compose -f nodejs-express-mongo/docker-compose.yml down -v