|
1 | | -# Remote interface |
2 | | -## Introduction |
3 | | - |
4 | | -``` |
5 | | - +-----------------------------------------------+ |
6 | | - | remote interface | |
7 | | - | +----------------------------------------+ | |
8 | | - | +----------------------------------------+| | |
9 | | - | +----------------------------------------+|+ | |
10 | | - | | RabbitMQ-provided RPC |+ | |
11 | | - | +----------------------------------------+ | |
12 | | - | | ^ | |
13 | | - +------------|---------------------|------------+ |
14 | | - +------------|---------------------|------------+ |
15 | | - | | RabbitMQ broker | | |
16 | | - | | | | |
17 | | - | | +------------------+ | |
18 | | - | v +------------------+| | |
19 | | - | +------------------+ +------------------+|| | |
20 | | - | | incoming queue | | private queue ||| | |
21 | | - | | | | ||| | |
22 | | - | | - trytes | | - PoW result ||| | |
23 | | - | | - mwm | | ||+ | |
24 | | - | | | | |+ | |
25 | | - | +------------------+ +------------------+ | |
26 | | - | | ^ | |
27 | | - +------------|---------------------|------------+ |
28 | | - v | |
29 | | - +---------------------------------------------+ |
30 | | - +---------------------------------------------+| |
31 | | - +---------------------------------------------+|+ |
32 | | - | remote worker |+ |
33 | | - +---------------------------------------------+ |
34 | | -``` |
35 | | -To support asynchronous remote procedure call, remote interface in dcurl provides an interface named as `Remote_ImplContext` to implement it. dcurl currently uses RabbitMQ C client to implement asynchronous RPC in remote interface. Remote interface provides thread management to support an asynchronous RPC per thread. |
36 | | - |
37 | | -Here are detailed implementations of the RabbitMQ-provided RPC pattern as follows: |
38 | | -* Asynchronous RPC requests are inserted into the message queue, `incoming_queue`, in RabbitMQ broker |
39 | | -* Asynchronous RPCs with exclusive private queues (callback queues) with TTL = 10s property |
40 | | -* Correlation ID is not used |
41 | | -* An asynchronous RPC uses a connection to RabbitMQ broker |
42 | | -* Remote workers can obtain requests from `incoming_queue` by default exchange of RabbitMQ broker |
43 | | - |
44 | | -## How to test remote interface in localhost |
45 | | -You need to open three terminals |
46 | | - |
47 | | -Terminal 1: Run the RabbitMQ broker You can quickly use docker to run the RabbitMQ broker, rabbitmq |
48 | | -``` |
49 | | -$ sudo docker run -d rabbitmq |
50 | | -``` |
51 | | - |
52 | | -Terminal 2: Run remote workers |
53 | | -``` |
54 | | -$ ./build/remote-worker |
55 | | -``` |
56 | | -How to build remote worker on FPGA board |
57 | | -``` |
58 | | -$ make BUILD_REMOTE=1 BUILD_FPGA_ACCEL=1 BOARD=de10nano |
59 | | -``` |
60 | | - |
61 | | -Terminal 3: Run check |
62 | | -``` |
63 | | -$ make BUILD_REMOTE=1 BUILD_DEBUG=1 check |
64 | | -``` |
65 | | - |
66 | | -## Requirements |
67 | | -Remote interface requires RabbitMQ broker |
| 1 | +# Remote interface |
| 2 | +## Introduction |
| 3 | + |
| 4 | +``` |
| 5 | + +-----------------------------------------------+ |
| 6 | + | remote interface | |
| 7 | + | +----------------------------------------+ | |
| 8 | + | +----------------------------------------+| | |
| 9 | + | +----------------------------------------+|+ | |
| 10 | + | | RabbitMQ-provided RPC |+ | |
| 11 | + | +----------------------------------------+ | |
| 12 | + | | ^ | |
| 13 | + +------------|---------------------|------------+ |
| 14 | + +------------|---------------------|------------+ |
| 15 | + | | RabbitMQ broker | | |
| 16 | + | | | | |
| 17 | + | | +------------------+ | |
| 18 | + | v +------------------+| | |
| 19 | + | +------------------+ +------------------+|| | |
| 20 | + | | incoming queue | | private queue ||| | |
| 21 | + | | | | ||| | |
| 22 | + | | - trytes | | - PoW result ||| | |
| 23 | + | | - mwm | | ||+ | |
| 24 | + | | | | |+ | |
| 25 | + | +------------------+ +------------------+ | |
| 26 | + | | ^ | |
| 27 | + +------------|---------------------|------------+ |
| 28 | + v | |
| 29 | + +---------------------------------------------+ |
| 30 | + +---------------------------------------------+| |
| 31 | + +---------------------------------------------+|+ |
| 32 | + | remote worker |+ |
| 33 | + +---------------------------------------------+ |
| 34 | +``` |
| 35 | +To support asynchronous remote procedure call, remote interface in dcurl provides an interface named as `Remote_ImplContext` to implement it.\ |
| 36 | +dcurl currently uses RabbitMQ C client to implement asynchronous RPC in remote interface.\ |
| 37 | +Remote interface provides thread management to support an asynchronous RPC per thread. |
| 38 | + |
| 39 | +Here are detailed implementations of the RabbitMQ-provided RPC pattern as follows: |
| 40 | +* Asynchronous RPC requests are inserted into the message queue, `incoming_queue`, in RabbitMQ broker |
| 41 | +* Asynchronous RPCs with exclusive private queues (callback queues) with TTL = 10s property |
| 42 | +* Correlation ID is not used |
| 43 | +* An asynchronous RPC uses a connection to RabbitMQ broker |
| 44 | +* Remote workers can obtain requests from `incoming_queue` by default exchange of RabbitMQ broker |
| 45 | + |
| 46 | +## How to test remote interface in localhost |
| 47 | +You need to open three terminals |
| 48 | + |
| 49 | +**Terminal 1:**\ |
| 50 | +Run the RabbitMQ broker\ |
| 51 | +You can quickly use docker to run the RabbitMQ broker, rabbitmq |
| 52 | +``` |
| 53 | +$ sudo docker run -d -p 5672:5672 rabbitmq |
| 54 | +``` |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +**Terminal 2:**\ |
| 59 | +Build and run the remote worker |
| 60 | +``` |
| 61 | +$ cd dcurl |
| 62 | +$ make BUILD_REMOTE=1 BUILD_DEBUG=1 |
| 63 | +$ ./build/remote-worker |
| 64 | +``` |
| 65 | + |
| 66 | +--- |
| 67 | + |
| 68 | +**Terminal 3:**\ |
| 69 | +Run the tests to send requests to remote worker |
| 70 | +``` |
| 71 | +$ cd dcurl |
| 72 | +$ make BUILD_REMOTE=1 BUILD_DEBUG=1 check |
| 73 | +``` |
| 74 | + |
| 75 | +## Requirements |
| 76 | +Remote interface requires RabbitMQ broker |
0 commit comments