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