'/instances/{id}/content/*' API results are different in docker swarm(replicas of orthanc)

Dear Team
I am using 2 orthanc service(replicas), 1 mysql service(orthanc database) in docker swarm.
The problem is that the 2 orthanc services respond to different byteArray length of content.
(For your information, I’m using a private tag, 0087-0089)

Problem steps
(The sizes of file1.dcm and file2.dcm are different, but the study uuid is the same. It will be overwritten.)

  1. Start 2 orthanc service in docker swarm
  2. Upload file1.dcm(POST ‘/instances’) to orthanc1 container
  3. Call API 4 times ‘/instances/{id}/content/0087-0089’
    • orthanc1, orthanc2 both return the same size of file1.dcm
  4. Upload file2.dcm(POST ‘/instances’) to orthanc2 container
  5. Call API 4 times ‘/instances/{id}/content/0087-0089’
    • orthanc1 container return the file1.dcm content size
    • orthanc2 container return the file2.dcm content size

Test with the following docker-compose.yml.

image: orthancteam/orthanc:latest
environment:
      - ORTHANC__AWS_S3_STORAGE__BUCKET_NAME=***
      - ORTHANC__MYSQL__ENABLE_INDEX=true
      - ORTHANC__MYSQL__ENABLE_STORAGE=false
      - ORTHANC__MYSQL__HOST=database
      - ORTHANC__MYSQL__PORT=3306
      - ORTHANC__REMOTE_ACCESS_ALLOWED=true
      - ORTHANC__AUTHENTICATION_ENABLED=true
      - ORTHANC__REGISTERED_USERS={"***":"***"}
      - ORTHANC__ORTHANC_EXPLORER_2__ENABLE=true
      - ORTHANC__ORTHANC_EXPLORER_2__IS_DEFAULT_ORTHANC_UI=true
      - ORTHANC__DICOM_WEB__ENABLE=true
      - ORTHANC__STORE_DICOM=false
      - ORTHANC__OVERWRITE_INSTANCES=true
      - VERBOSE_STARTUP=true
      - VERBOSE_ENABLED=true
secrets:
      - ORTHANC__AWS_S3_STORAGE__REGION
      - ORTHANC__AWS_S3_STORAGE__ACCESS_KEY
      - ORTHANC__AWS_S3_STORAGE__SECRET_KEY
      - ORTHANC__MYSQL__USERNAME
      - ORTHANC__MYSQL__DATABASE
      - ORTHANC__MYSQL__PASSWORD

orthanc.json, automatically created when the orthanc container starts.

{
  "MySQL": {
    "EnableIndex": true,
    "Port": 3306,
    "EnableStorage": false,
    "Host": "database",
    "Password": "xxx",
    "Username": "xxx",
    "Database": "orthanc",
    "Lock": false
  },
  "RegisteredUsers": {
    "xxx": "xxx"
  },
  "DicomWeb": {
    "Enable": true,
    "PublicRoot": "/pacs/dicom-web/"
  },
  "AwsS3Storage": {
    "BucketName": "xxx",
    "AccessKey": "xxx",
    "Region": "xxx",
    "SecretKey": "xxx"
  },
  "StoreDicom": false,
  "OrthancExplorer2": {
    "Enable": true,
    "IsDefaultOrthancUI": true
  },
  "AuthenticationEnabled": true,
  "OverwriteInstances": true,
  "RemoteAccessAllowed": true,
  "StorageDirectory": "/var/lib/orthanc/db",
  "HttpsCACertificates": "/etc/ssl/certs/ca-certificates.crt",
  "Plugins": [
    "/run/orthanc/plugins",
    "/usr/share/orthanc/plugins"
  ],
  "Gdcm": {
    "Throttling": 4,
    "RestrictTransferSyntaxes": [
      "1.2.840.10008.1.2.4.90",
      "1.2.840.10008.1.2.4.91",
      "1.2.840.10008.1.2.4.92",
      "1.2.840.10008.1.2.4.93"
    ]
  }
}

I applied step by step in the above configuration. but not working.

- ORTHANC__MAXIMUM_STORAGE_CACHE_SIZE=0
- ORTHANC__MAXIMUM_STORAGE_SIZE=0
- ORTHANC__MAXIMUM_PATIENT_COUNT=0
- ORTHANC__MAXIMUM_STORAGE_MODE=Reject
- ORTHANC__JOBS_HISTORY_SIZE=0
- ORTHANC__SAVE_JOBS=false
- ORTHANC__CHECK_REVISIONS=true
- ORTHANC__STABLE_AGE=1
- ORTHANC__STORAGE_COMPRESSION=false
- ORTHANC__LIMIT_FIND_RESULTS=100
- ORTHANC__LIMIT_FIND_INSTANCES=100
- ORTHANC__KEEP_ALIVE=true
- ORTHANC__TCP_NO_DELAY=true
- ORTHANC__STORAGE_ACCESS_ON_FIND=Never
- ORTHANC__SYNCHRONOUSE_C_MOVE=true

Any help on best way to approach this would be much appreciated.

Thanks in advance.

Hong

Hi,

Each Orthanc maintains its own DICOM file cache in memory. If you overwrite files with a different version, the orthanc1 will still have its cached copy, so I would assume that disabling the cache completely would solve the issue:

  // Maximum size of the storage cache in MB.  The storage cache
  // is stored in RAM and contains a copy of recently accessed
  // files (written or read).  A value of "0" indicates the cache
  // is disabled.  (new in Orthanc 1.10.0)
  "MaximumStorageCacheSize" : 128,

However, if I remember correctly, even when the cache is disabled, Orthanc caches the last opened DICOM file in memory. So, I would say that your problem would not happen then if another file is uploaded to Orthanc1.

I have just added an item in our TODO to potentially fix that issue in the future.

Best regards,

Alain

Thank you for your answer.

I set the MaximumStorageCacheSize value to 1 because the file I save usually has a size of 4 to 8mb, but it’s the same problem.

Please let me know if you need more information to solve the problem.

Thank you.