I have a web application written completely in the usual html/css/javascript and some additional stuff using jQuery.
I also have a pretty huge program written in python which needs to act on the input provided by the user on my web app.
Currently, I am writing the input from Php onto a file and reading it in python to do my manipulations.
Is there a better to achieve this sync?
Also, I need to execute my python program as soon as some user clicks the submit button. How do I make python wait for this?
I have a web application written completely in the usual html/css/javascript and some additional
Share
Your way of syncing creates quite a big overhead due to severe I/O operations on regular files, you must deal with locks, and even small load growth can cause overall system crash.
What I’d recommend you is to get acquainted with IPC techniques commonly used to exchange information between two processes:
There are also some techniques left out of scope, but I’ve chose those 3 ways for arranging IPC because they’re the simplest and the fastest in implementation.
You can try all of them, or some, and analyze what would be the best way in your specific case.