From fa1306a6a23449cd1c2547f7dec5d82c96462127 Mon Sep 17 00:00:00 2001 From: ajubuntu Date: Sun, 12 May 2019 16:45:48 -0700 Subject: [PATCH] docs: Describe implementation of remote interface --- docs/remote-interface.md | 67 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 docs/remote-interface.md diff --git a/docs/remote-interface.md b/docs/remote-interface.md new file mode 100644 index 0000000..84f24ab --- /dev/null +++ b/docs/remote-interface.md @@ -0,0 +1,67 @@ +# Remote interface +## Introduction + +``` + +-----------------------------------------------+ + | remote interface | + | +----------------------------------------+ | + | +----------------------------------------+| | + | +----------------------------------------+|+ | + | | RabbitMQ-provided RPC |+ | + | +----------------------------------------+ | + | | ^ | + +------------|---------------------|------------+ + +------------|---------------------|------------+ + | | RabbitMQ broker | | + | | | | + | | +------------------+ | + | v +------------------+| | + | +------------------+ +------------------+|| | + | | incoming queue | | private queue ||| | + | | | | ||| | + | | - trytes | | - PoW result ||| | + | | - mwm | | ||+ | + | | | | |+ | + | +------------------+ +------------------+ | + | | ^ | + +------------|---------------------|------------+ + v | + +---------------------------------------------+ + +---------------------------------------------+| + +---------------------------------------------+|+ + | remote worker |+ + +---------------------------------------------+ +``` +To support asynchronouse remote procedure call, remote interface, `Remote_ImplContext`, in dcurl provides an interface to implement it. dcurl currently uses RabbitMQ C client to implement asynchronouse RPC in remote interface. Remote interface provides thread management to can run an asynchronouse RPC per thread. + +Here are detailed implementations of the RabbitMQ-provided RPC pattern as follows: +* Asynchronouse RPC requests are inserted into the message queue, `incoming_queue`, in RabbitMQ broker +* Asynchronouse RPCs with exclusive private queues (callback queues) with TTL = 10s property +* Correlation ID is not used +* An asynchronouse RPC uses a connection to RabbitMQ broker +* Remote workers can obtain requests from `incoming_queue` by default exchange of RabbitMQ broker + +## How to test remote interface in localhost +You need to open three terminals + +Terminal 1: Run the RabbitMQ broker You can quickly use docker to run the RabbitMQ broker, rabbitmq +``` +$ sudo docker run -d rabbitmq +``` + +Terminal 2: Run remote workers +``` +$ ./build/remote-worker +``` +How to build remote worker on FPGA board +``` +$ make BUILD_REMOTE=1 BUILD_FPGA_ACCEL=1 BOARD=de10nano +``` + +Terminal 3: Run check +``` +$ make BUILD_REMOTE=1 BUILD_DEBUG=1 check +``` + +## Requirements +Remote interface requires RabbitMQ broker