annotate Sphinx/source/plugins/transfers.rst @ 933:a5e7e7001316 Orthanc-1.12.0

Orthanc 1.12.0
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 15 Apr 2023 10:44:42 +0200
parents dafff7d1c975
children 1316bc62b5d5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
164
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 .. _transfers:
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 Transfers accelerator plugin
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 ============================
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 .. contents::
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 Osimis provides a `transfers accelerator plugin
449
2922fb1bd65e fix links
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 361
diff changeset
10 <https://hg.orthanc-server.com/orthanc-transfers/file/default>`__ whose
164
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 purpose is to speed up the transfers of DICOM instances over networks
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 (with respect to the native DICOM protocol or to the built-in
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 :ref:`Orthanc peers <peers>` mechanism).
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 Description
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 -----------
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 This plugin can be used to **send** local images to remote Orthanc
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 peers, or to locally **retrieve** images stored on remote Orthanc
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 peers.
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 The plugin also implements **storage commitment**, i.e. the peer that
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 initiates the transfer is informed whether *all* the DICOM instances
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 have been properly received by the other peer. The DICOM instances are
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 individually validated using their MD5 checksum. In other words, this
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 plugin provides atomicity in the transfers (i.e. a study/series is
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 considered as a whole, and partial transfers are prevented).
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 Note that the protocol is **entirely built over HTTP/HTTPS** (and not
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 directly over TCP), making it friendly with network firewalls and Web
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 caches. Also, the plugin takes advantage of the **jobs engine** of
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 Orthanc, so that transfers can be easily paused/canceled/resubmitted.
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 Technically, this plugin extends the REST API of Orthanc with
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 endpoints that optimize the use of the network bandwidth over the HTTP
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 and HTTPS protocols, through the combination of the following
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 mechanisms:
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 * Small DICOM instances are grouped together to form so-called
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 "buckets" of some megabytes in order to reduce the number of HTTP
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 handshakes.
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 * Large DICOM instances are split as a set of smaller buckets in
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 order to bypass nasty effects of TCP congestion control on
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 low-quality network links.
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 * Buckets are downloaded/uploaded concurrently by several threads.
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 * Buckets can be individually compressed using the gzip algorithm,
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 hereby reducing the network usage. On a typical medical image, this
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 can divide the volume of the transmission by a factor 2 to 3, at
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 the price of a larger CPU usage.
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 * Sending images to remote Orthanc peers can either be done with HTTP
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 ``PUT`` requests (so-called "push mode"), or with HTTP ``GET``
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 requests if the local Orthanc server has a public IP address
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 (so-called "pull mode").
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 Compilation
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 -----------
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 Static linking
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 ^^^^^^^^^^^^^^
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 .. highlight:: text
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 The procedure to compile the plugin is similar to that for the
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 :ref:`core of Orthanc <compiling>`. The following commands should work
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 for most UNIX-like distribution (including GNU/Linux)::
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 $ mkdir BuildTransfers
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 $ cd BuildTransfers
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 $ cmake .. -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 $ make
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 The compilation will produce the shared library ``OrthancTransfers``
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 that can be loaded as a plugin by Orthanc.
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 Microsoft Windows
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 ^^^^^^^^^^^^^^^^^
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 Pre-compiled binaries for Microsoft Windows `are available
358
011b01ccf52d fixing external hyperlinks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 221
diff changeset
87 <https://www.orthanc-server.com/browse.php?path=/plugin-transfers>`__.
164
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 Dynamic linking on Ubuntu 16.04
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 .. highlight:: text
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 If static linking is not desired, here are build instructions for
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 Ubuntu 16.04 (provided build dependencies for the :ref:`core of
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 Orthanc <compiling>` have already been installed)::
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 $ mkdir BuildTransfers
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 $ cd BuildTransfers
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 $ cmake .. -DCMAKE_BUILD_TYPE=Release \
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 -DALLOW_DOWNLOADS=ON \
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 -DUSE_SYSTEM_GOOGLE_TEST=OFF \
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 -DUSE_SYSTEM_ORTHANC_SDK=OFF
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 $ make
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 Basic usage: Sending images
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 ---------------------------
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 .. highlight:: json
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 You of course first have to :ref:`install Orthanc <binaries>`, with a
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 version above 1.4.2. Secondly, you have to load the plugin and to
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 **declare the remote Orthanc peers** in the :ref:`configuration file
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 <configuration>`. Here is a minimal example (obviously, adapt the
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 parameters)::
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 {
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 "Name" : "MyOrthanc",
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 "Plugins" : [
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 "/home/user/orthanc-transfers/BuildTransfers/libOrthancTransfers.so"
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 ],
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 "OrthancPeers" : {
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 "remote" : [ "http://1.2.3.4:8042/" ]
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 }
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 }
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 Once Orthanc is running, when you open a patient, a study, or a series
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 in :ref:`Orthanc Explorer <orthanc-explorer>`, you will see a new
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 yellow button entitled ``Transfers accelerator``. By clicking on this
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 button, you will be able to send the local patient/study/series to one
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 of the remote Orthanc peers (provided they are also equipped with the
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 transfers accelerator plugin).
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 REST API
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 --------
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 .. highlight:: bash
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 Here is a sample command line to **receive** a patient from the remote
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 peer called ``remote``::
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144
890
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
145 $ curl -v -X POST http://localhost:8042/transfers/pull \
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
146 --data '{
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
147 "Resources" : [{"Level":"Patient","ID":"16738bc3-e47ed42a-43ce044c-a3414a45-cb069bd0"}],
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
148 "Compression" : "gzip",
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
149 "Peer" : "remote"
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
150 }'
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
151
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
152
164
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 Note that several resources from different levels (patient, study,
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 series or instances) can be retrieved at once.
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 Conversely, here is a sample command line to **send** the same patient
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 to the remote peer ``remote``::
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159
890
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
160 $ curl -v -X POST http://localhost:8042/transfers/send \
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
161 --data '{
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
162 "Resources" : [{"Level":"Patient","ID":"16738bc3-e47ed42a-43ce044c-a3414a45-cb069bd0"}],
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
163 "Compression" : "gzip",
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
164 "Peer" : "remote"
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
165 }'
164
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 The command above is the one that is issued by Orthanc Explorer under
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 the hood (see section above).
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 Sending in pull vs. push mode
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 -----------------------------
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 In the case DICOM instances are being **sent** to a remote peer, the
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 plugin can work in two different modes:
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 * In **"pull" mode**, the plugin will transfer images by using as many
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 HTTP ``GET`` requests as possible.
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 * In **"push" mode**, it will use a sequence of HTTP ``PUT`` requests.
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 Push mode is easier to setup, but pull mode should be favored, as it
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 might lead to improved performance in the presence of Web caches. For
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 pull mode to work, the remote peer must be able to make calls to the
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 REST API of the local peer. This often means that the local peer has a
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 public IP address.
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 In order to enable pull mode to send image from Orthanc peer "A" to
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 another Orthanc peer "B", 2 actions must be taken:
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 1. "B" must have "A" defined as one of its peers, by adding "A" to its
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 ``OrthancPeers`` configuration section.
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 2. "A" must also have "B" defined as one of its peers, and the
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 ``RemoteSelf`` property must be provided for peer "B". This option
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 specifies the symbolic name under which "B" is known to "A".
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 .. highlight:: json
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 Here is a sample configuration for "A"::
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 {
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 "Name" : "A",
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 "Plugins" : [
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 "/home/user/orthanc-transfers/BuildTransfers/libOrthancTransfers.so"
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 ],
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 "OrthancPeers" : {
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 "B" : {
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 "Url" : "http://b.myinstitution.com:8042/",
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 "RemoteSelf" : "A"
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 }
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 }
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 }
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 And here is a sample configuration for "B"::
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 {
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 "Name" : "B",
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 "Plugins" : [
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 "/home/user/orthanc-transfers/BuildTransfers/libOrthancTransfers.so"
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 ],
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 "OrthancPeers" : {
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 "A" : {
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 "Url" : "http://a.myinstitution.com:8042/"
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 }
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 }
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 }
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 NB: **Receiving** images is always done in pull mode.
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 Advanced options
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 ----------------
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 Besides the ``OrthancPeers`` configuration option, several advanced
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 options are available to fine-tune the configuration of the
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 plugin. They are listed below::
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 {
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 ...
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 "HttpTimeout" : 120, // Can be increased on slow networks
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 "Transfers" : {
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 "Threads" : 6, // Number of worker threads for one transfer
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 "BucketSize" : 4096, // Optimal size for a bucket (in KB)
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 "CacheSize" : 128, // Size of the memory cache to process DICOM files (in MB)
221
26441131d725 option MaxHttpRetries in transfers accelerator
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 164
diff changeset
250 "MaxPushTransactions" : 4, // Maximum number of simultaneous receptions in push mode
916
Alain Mazy <am@osimis.io>
parents: 890
diff changeset
251 "MaxHttpRetries" : 0, // Maximum number of HTTP retries for one bucket
Alain Mazy <am@osimis.io>
parents: 890
diff changeset
252 "PeerConnectivityTimeout": 2 // HTTP Timeout (in seconds) used when checking if a remote peer has the transfer plugin enabled in /transfers/peers GET route
164
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 }
05aa4f426621 transfers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 }
890
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
255
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
256
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
257 Working with load-balancers
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
258 ---------------------------
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
259
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
260 .. highlight:: bash
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
261
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
262 If the receiving Orthanc instance is implemented by a cluster of Orthanc instances
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
263 behind a load-balancer, it is very important that all requests relating to a single
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
264 **"push"** transfer target the same Orthanc instance.
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
265
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
266 In order to achieve this, in your load-balancer, you may use the ``sender-transfer-id``
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
267 HTTP header to route the requests. This header is populated in every outgoing HTTP request.
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
268 By default, its value is a random uuid. If required, you may force the value of this
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
269 HTTP header by adding a ``SenderTransferID`` field in the payload when creating
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
270 the transfer::
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
271
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
272 $ curl -v -X POST http://localhost:8042/transfers/send \
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
273 --data '{
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
274 "Resources" : [{"Level":"Patient","ID":"16738bc3-e47ed42a-43ce044c-a3414a45-cb069bd0"}],
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
275 "Compression" : "gzip",
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
276 "Peer" : "remote",
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
277 "SenderTransferID" : "my-transfer-id"
1af054b77e9c transfer: load-balancer
Alain Mazy <am@osimis.io>
parents: 449
diff changeset
278 }'