Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions benchmark/RESP-py-bench-2.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,20 +310,22 @@ def benchmark_read_concurrent(client: MultiThreadedRedisClient, pool: BufferPool
parser.add_argument("--pool-size", type=int, default=1024)
parser.add_argument("--buffer-size", type=int, default=4194304) # 4 MB
parser.add_argument("--num-threads", type=int, required=False)
parser.add_argument("--host", type=str, default="localhost")
parser.add_argument("--port", type=int, default=6379)
args = parser.parse_args()
pool = BufferPool(pool_size=args.pool_size, buffer_size=args.buffer_size)


# single threaded
if args.num_threads is None:
print("Running single threaded benchmark")
client = RedisClient(host="localhost", port=6379, buffer_size=args.buffer_size)
client = RedisClient(host=args.host, port=args.port, buffer_size=args.buffer_size)
benchmark_write(client, pool)
benchmark_read(client, pool)

# multi threaded codepath
else:
print(f"Running multi threaded benchmark with {args.num_threads} threads")
client = MultiThreadedRedisClient(host="localhost", port=6379, buffer_size=args.buffer_size, num_threads=args.num_threads)
client = MultiThreadedRedisClient(host=args.host, port=args.port, buffer_size=args.buffer_size, num_threads=args.num_threads)
benchmark_write_concurrent(client, pool)
benchmark_read_concurrent(client, pool)
benchmark_read_concurrent(client, pool)