I want to spawn several processeses each hosting a HTTPServer listening to a different port.
I'm doing:
def launch_webserver(host, port):
server = HTTPServer((host, port), handler_class)
try:
server.serve_forever()
finally:
server.socket.close()
for num in range(arguments.number):
port = arguments.port + num
process = Process(target=launch_webserver, args=(arguments.host, port))
process.start()
It works and I can confirm that each webserver is listening properly. These just need to collect some data and are not heavily demanding on CPU or IO.
How do I profile this kind of application? How can I determine the maximum number of processess. Is there any Python or system limit I should be aware of? I'm running this on Python 3 in an Ubuntu machine.