A scalable, high-performance DICOM load-balancer and router designed for medical imaging workflows. This solution provides zero-downtime operation for PACS (Picture Archiving and Communication System) environments, supporting advanced routing rules, automated health-checks, and seamless integration into any medical-imaging infrastructure.
- High-Performance Load Balancing: Efficiently distribute DICOM traffic across multiple PACS nodes
- Zero-Downtime Operation: Ensure continuous service availability for critical medical imaging workflows
- Advanced Routing Rules: Route DICOM studies based on modality, body part, institution, and other DICOM tags
- Automated Health Checks: Continuously monitor destination nodes and automatically redirect traffic from failed nodes
- Horizontal Scaling: Deploy multiple instances for increased throughput and reliability
- Comprehensive Metrics: Monitor performance, throughput, and system health with detailed metrics
- DICOM Compliance: Full compatibility with DICOM standards for seamless integration
This project combines HAProxy for TCP load balancing with DCMTK tools for DICOM processing. The architecture includes:
- Frontend Service (HAProxy): Listens on port 11112 for incoming DICOM connections
- Routing Logic (Lua): Parses DICOM headers and routes traffic based on modality and other DICOM tags
- Backend Services: Multiple DICOM storage nodes available for routing traffic
- Health Monitoring: Automated health checks to ensure backends are available
- Docker/Podman for container deployment
- Basic understanding of DICOM and PACS architecture
-
Clone this repository:
git clone https://github.com/your-username/dicom-loadbalancer.git cd dicom-loadbalancer -
Build the container:
make build -
Run the container:
make run
The main configuration file is located at config/haproxy.cfg. This file defines:
- Frontend and backend services
- TCP listening ports
- Health check parameters
- DICOM routing rules
DICOM routing is implemented in scripts/parser.lua. This Lua script:
- Extracts relevant DICOM tags from incoming requests
- Applies routing rules based on modality, SOP Class UID, patient ID, etc.
- Routes traffic to appropriate backends based on these rules
Example routing rules:
- CT images → CT servers
- MR images → MR servers
- Patient-based load balancing → General servers 1-3
The project includes a directory for DICOM samples that can be used for testing:
make run
This will start the container with the sample DICOM directory mounted.
The HAProxy stats dashboard is available at:
http://localhost:8404/stats
Default credentials: admin:yourpassword (configurable in haproxy.cfg)
config/- Configuration files for HAProxyscripts/- Lua scripts for DICOM routing and forwardingdicom-samples/- Test DICOM filesDockerfile- Container definition using Alpine Linux and DCMTKMakefile- Build and run commandsentrypoint.sh- Container startup script
The project uses semantic versioning. To bump the version:
make bump-version
See the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request