Skip to content
goindi edited this page Dec 10, 2018 · 3 revisions

What is it?:

Implementation of Symphony REST API in Python using asynchronous calls.

Why was it developed:

I started implementing Symphony's REST API in Python a year ago. Back then there was no Python API from Symphony. I used requests module to make the calls. As the customer base increased I noticed sluggishness. The reason was 300ms/post call to send message. It was in a single process and so 100 messages took 30 sec - too laggy.

The way out of this was - multi-threading or redoing everything in nodejs. I did not like either option and luckily came across asyncio and aiohttp - Python libraries with asychronous event loop. This was perfect for my needs.

The lag went from 300ms to under 4 ms. Current symphony python api does not have this feature so hopefully this can help.

How can I use this:

Clone this and you should have it working right out of the box. But you do need a couple of things is you want it to work as is

  1. A redis server
  2. A working Symphony agent
  3. The sender and listener talk to backend via files. The files are in /tmp(configurable in symphony_config.py). You will need a way to create and read files for this to work right our. Alternatively, you can use your own way to communicate (sockets, IPC)

How to test:

Use test_sending.py to see how fast this is.

Clone this wiki locally