Docker deployment: GPU vs CPU performance comparison? #12
-
|
Hi everyone, I am planning to deploy german-ocr in production and trying to decide between GPU and CPU deployment. My requirements:
Questions:
Current Docker setup: FROM python:3.11-slim
RUN pip install german-ocr
CMD ["python", "-m", "german_ocr.server"]Would love to hear from anyone running this in production! |
Beta Was this translation helpful? Give feedback.
Answered by
Keyvanhardani
Jan 1, 2026
Replies: 1 comment
-
|
Great timing - I have been running german-ocr in production for several months now. Here are my real-world findings: 1. GPU vs CPU Performance
For 1000 docs/day with <5s requirement: CPU c5.2xlarge or T4 GPU both work well. 2. Cost-Effectiveness Sweet SpotSpot instances can reduce costs by 60-70%! 3. Docker Optimizations# Optimized Dockerfile
FROM python:3.11-slim AS base
# Install system dependencies in single layer
RUN apt-get update && apt-get install -y --no-install-recommends \n libgl1-mesa-glx libglib2.0-0 && \n rm -rf /var/lib/apt/lists/*
# Use multi-stage for smaller image
FROM base AS runtime
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Pre-download models during build
RUN python -c "from german_ocr import OCREngine; OCREngine()"
# Optimize for production
ENV OMP_NUM_THREADS=4
ENV MALLOC_TRIM_THRESHOLD_=100000
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:8000", "app:app"]Pro Tips
# docker-compose.yml snippet
services:
ocr:
deploy:
resources:
limits:
memory: 4G
reservations:
memory: 2GHappy to share more details about our production setup! |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
DefcoGit
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great timing - I have been running german-ocr in production for several months now. Here are my real-world findings:
1. GPU vs CPU Performance
For 1000 docs/day with <5s requirement: CPU c5.2xlarge or T4 GPU both work well.
2. Cost-Effectiveness Sweet Spot
Spot instances can reduce costs by 60-70%!
3. Docker Optimizations
# …