3

Some years ago, (for comparison) synchronous JavaScript ajax requests were deprecated because of the overhead.
I’m in the following situation :

def ssh_network_operation_with_paramiko(string):
    server_response=Do_some_stuff_with_null_characters_in_string(string)
    Do_something_with_server_response(server_response)

for i in very_very_large_range
    ssh_network_operation_with_paramiko(i)

Basically, using process or threads would be synonym of creating a fork bomb.

So is it possible to do perform asynchronous calls without creating threads or process like with ajax in JavaScript ? Because all I found currently involve creating threads or process were each of them perform only one function at time.

4
  • Use some kind of thread pool? Commented Nov 2, 2015 at 19:44
  • @Drakosha : In a python multiprocessing pool, each process perform one function at time (implying waiting for server response), which is too slow. Commented Nov 2, 2015 at 19:53
  • 1
    not sure what you are looking for. In any case thread can do only one thing at a time. You might be looking for asynchronous operations. Commented Nov 17, 2015 at 19:20
  • @Drakosha yes, but with paramiko? Commented Feb 15, 2016 at 13:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.