Load balancing multiple writers

Hello.

Since the new 1.9.2 Orthanc release I was wondering about how one could implement a load balancer for multiple writers listening through DICOM. Is that possible with the DICOM protocol or only with DICOMweb?

Hi Diego,

You could use NGINX to act as a tcp load balancer (https://docs.nginx.com/nginx/admin-guide/load-balancer/tcp-udp-load-balancer/). I know you can use NGUNX to proxy a simple dicom connection but have not tried it to load balance the connections. Give it a go and let us know how it goes.

There are other proxys you could use use as HA Proxy or Traefik.

James

Binary Logo

James Manners • Director
Suite 3, Level 2, 10 Queens Road, Melbourne, Victoria 3004, Australia

T: 03 9017 5230 M: 0422 973 235 E: james@binary.com.au W: binary.com.au

Hi James!

I set up a test environment with Docker similar to what i already have in production. Since the NGINX Docker image comes with streaming support out of the box, it was easier than i expected.

However, i have seen no significant improvement in storage times with this new setup. I compared the storage times of 11 studies sent all at once (8 CRs, 1 DX, 1 CT, 1 MR) between 1 writer Orthanc and N writer Orthancs architecture
The times always ranged between 5~6 minutes with the 1 Orthanc architecture being faster. Since it was a quick test, maybe i forgot some important configuration.

Anyway, here is the source code of the test project (created with Docker Compose). It is attached on this post.

The tests were run under Docker on Windows 10.

multiple-writers-test.zip (4.39 KB)

I thought about routing incoming studies to different modalities based on their type (CR, DX, etc). The problem with routing is that i can only send the instance to another modality when it is already stored on the first one.

And since C-STORE doesn’t have headers identifying the modality, NGINX can’t decide anything besides the least_conn setting.

I was looking at ReceivedInstanceFilter, but I couldn’t find a Python equivalent event. I don’t know but i could use that event to send the instance to an Orthanc writer peer and reject the instance returning false. I will get back when i have some results on that.

The “OrthancPluginRegisterIncomingHttpRequestFilter2()” primitive of the C/C++ SDK corresponds to Lua callback “ReceivedInstanceFilter()”:
https://sdk.orthanc-server.com/group__Callbacks.html#ga49e34b40e43b222031540ea305246e3f

This C primitive is not automatically mapped by the code generation using Clang, but could certainly be manually wrapped:
https://book.orthanc-server.com/plugins/python.html#overview

In the meantime, consider writing a C/C++ plugin:
https://book.orthanc-server.com/developers/creating-plugins.html

Sébastien-

Sorry, typo, I was referring to “OrthancPluginRegisterIncomingDicomInstanceFilter()”:
https://sdk.orthanc-server.com/group__Callbacks.html#gafc862afa442d59adbb9affc8b7f51773