1

I have framework which communicates with the server over redis. I want to test it and therefore I wanted to send numerous requests at the same time (to simulate concurrent clients sending reqs to server at once). I know that I should use multiprocessing but one thing is not clear to me. Here is what I have:

def func(x):
client = rpcpyredis.Proxy("EchoService")
print(client.echo("test"))


if __name__ == '__main__':
  processes = []
  start = time.time()
  p_pool = Pool(4)
  p_results = p_pool.map(func, range(300))
  p_pool.close()
  p_pool.join()
  print(time.time() - start)

I am confused with the number of processess. Does calling the function this way means, that I have maximum of 4 concurrent clients at any moment of time, or does it mean that I have 300 concurrent clients (scheduled over 4 processes)?

client = rpcpyredis.Proxy("EchoService")

represents client object i.e. connection to Redis instance

Pegasus Thorn
  • 159
  • 1
  • 2
  • 12
  • Please always include your imports in your code here. – Darkonaut Mar 14 '19 at 17:21
  • You have four parallel workers and up to four clients at any moment of time here. Might help you understand: [Python multiprocessing: understanding logic behind chunksize](https://stackoverflow.com/q/53751050/9059420) – Darkonaut Mar 14 '19 at 17:21

0 Answers0