diff --git a/Monitor.md b/Monitor.md index a1bbec2..e4daa27 100644 --- a/Monitor.md +++ b/Monitor.md @@ -17,6 +17,12 @@ Monitor is written in Python, tested versions are 3.4 and 3.5. For it's function - pyyaml - parsing YAML configuration files - argparse - parsing command line arguments +**Monitor's architecture and message flow describes following diagram:** + +![Monitor message flow](https://raw.githubusercontent.com/ReCodEx/GlobalWiki/master/images/Monitor_arch.png) + +There are 2 threads - _Thread 1_ is main thread, which initializes all components like logger or starts the other thread and then runs the ZeroMQ part of the application. _Thread 2_ is responsible for managing all of WebSocket connections asynchronously. Whole thread is one big _asyncio_ event loop through which are processed all actions. None of custom data types is thread-safe, so all events from other threads (actually only `send_message` method) must be called within the event loop (via `asyncio.loop.call_soon_threadsafe` function). Please note, that most of the Python interpreter use GIL ([Global Interpreter Lock](https://wiki.python.org/moin/GlobalInterpreterLock)), so there is actualy no parallelism in the performance view, but proper synchronization is still required! + ## Installation Installation will provide you with following files: