Python: is the system function too slow?
Question: I have a small network with 3 computers. I have a C++ program on the 2nd
computer that reads packets from a network interface while the first computer
sends it data. I need to run that from the third computer. I wrote a small
python script using `flask`

    
    
    import os
    from flask import Flask
    app = Flask(__name__)
    
    @app.route("/")
    def hello():
        os.system("./a.out &")
    
    if __name__ == "__main__":
        app.run(host='0.0.0.0')
    

The problem is, there seems to be a small delay while starting the executable
using `os.system()` and the second computer misses some packets. Is there a
way to speed this up?


Answer: I would highly recommend the use of a queue of some sort. The performance of a
high level Web server calling a system function can be unpredictable (based on
how busy the machine is etc).

If you had a process reading in the background doing the communication and
queuing the packets and the Web endpoint reads from the queue, would be the
most reliable solution.

