How geshan/ollama-cloud-run works
Main Components
a) Client Layer:
• HTTP Clients (cURL or other API consumers)
• REST API endpoints (/api/generate)
b) Google Cloud Platform Layer:
• Cloud Run Service (Primary Component)
• Container Instance(s) with specifications:
• 32GB RAM
• 8 vCPUs
• OLLAMA_NUM_PARALLEL=4
• Cloud Build
• Artifact Registry
c) Model Layer:
• Ollama Runtime
• Gemma 9B Model
Flow Representation
[Development] → [Build/Deploy] → [Runtime]
Development:
• GitHub Repository
• ↓
Build/Deploy:
• Cloud Build → Artifact Registry
• ↓
Runtime:
• Client → Cloud Run → Ollama → Gemma Model
Important Details to Highlight
• Container Specifications:
• Resource allocations
• Concurrent request limit (4)
• Timeout setting (600s)
• Scaling Configuration:
• Min/max instances (≥4)
• CPU always allocated
• Startup CPU boost enabled
Data Flow Patterns
• Two distinct paths:
• Streaming response flow
• Non-streaming response flow
Performance Indicators
• Average response time: ~7.73s (as per README example)
• Image size: 5.4GB