An existing command-line program generates some output when called with some parameters, and then exits.
I would like to modify this program to run on an event loop, and listen through a public API (could be in same machine). There seem to be multiple ways of implementing this:
- make the API external to the program and do system calls
- turn the program into a library, and include the necessary functionality into the API itself
- local sockets (like a TCP line server, for eg.)
- HTTP server (producing JSON, XML, etc)
Considering efficiency under load, concurrency and scalability, what would be the best approach?
Api-design also depends on the clients, maybe you can give some more information:
Regarding scalability requirements:
Another idea could be a simple ssh-server so anyone can execute the script from outside:
Then you don’t need a overhead of event-listening loop.
What does the program do in more detail?