document-server/README.md
Nicolai Ort c9f28612be
All checks were successful
ci/woodpecker/tag/release Pipeline was successful
docs(README): Updated benchmark section
2024-12-12 18:05:52 +01:00

2.2 KiB

✒️ Document generation microservices

Features

  • 📝 HTML templates for pdf generation
  • 📚 OpenAPI/Swagger documentation
  • High-performance with go and gotenberg

🚀 Quick Start

# Install dependencies
go mod download

# Run the server
air

📖 API Documentation

Swagger UI is available at: /swagger

🛠️ Development

The project uses:

  • 🏃‍♂️ go as the language and build tool
  • 🌐 gofiber for the web framework
  • 📦 air for live reload
  • 📝 swaggo for API documentation
  • 📄 gotenberg for HTML to PDF conversion

📦 Use docker compose for external dependencies

docker compose -f docker-compose.dev.yaml up

🏃 Run via air

Install air via go install github.com/air-verse/air@latest

# With the default air config
air

# With the config for linux/macOS
air -c .air.linux.toml

# With the config for windows
air -c .air.windows.toml

✒️ Update the swagger docs

Install swag via go install github.com/swaggo/swag/cmd/swag@latest

swag init

🐋 Build container

# single arch
docker build -t registry.odit.services/lfk/document-server:latest .

# multiarch
docker buildx build --platform=linux/amd64,linux/arm64 -t registry.odit.services/lfk/document-server:latest --push .

⏱️ Benchmarks

Barcode Generation

  • Requests: 10000
  • Concurrency: Unlimited
  • Data: 123456789123
  • Width: 1000
  • Height: 500

No cache (cold start)

Format Data Requests/sec Slowest Fastest Average
Code128 123456789123 763.3996 0.7995 0.0172 0.0654
EAN13 123456789123 767.1170 0.7607 0.0171 0.0651
QR 123456789123 683.8472 0.6528 0.0178 0.0730

Redis cache (warm start)

Format Data Requests/sec Slowest Fastest Average
Code128 123456789123 15611.5521 0.0965 0.0006 0.0032
EAN13 123456789123 14985.4401 0.0925 0.0006 0.0033
QR 123456789123 14306.2540 0.1143 0.0005 0.0035