From f32e9a02a67e0a02c3f8136ca49e2bbf5ef18062 Mon Sep 17 00:00:00 2001 From: ppppaidy Date: Mon, 7 Oct 2024 11:34:40 -0400 Subject: [PATCH] fix: Request per sec must >= threads. Throw an error when conflcts --- socialNetwork/README.md | 2 +- wrk2/src/wrk.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/socialNetwork/README.md b/socialNetwork/README.md index f5be47ac9..a79efdd2c 100644 --- a/socialNetwork/README.md +++ b/socialNetwork/README.md @@ -87,7 +87,7 @@ cd ../socialNetwork Example: ```bash -../wrk2/wrk -D exp -t 12 -c 400 -d 300 -L -s ./wrk2/scripts/social-network/compose-post.lua http://10.109.126.103:8080/wrk2-api/post/compose -R 10 +../wrk2/wrk -D exp -t 5 -c 400 -d 300 -L -s ./wrk2/scripts/social-network/compose-post.lua http://10.109.126.103:8080/wrk2-api/post/compose -R 10 ``` #### Read home timelines diff --git a/wrk2/src/wrk.c b/wrk2/src/wrk.c index d0f9beef1..3dd67986c 100644 --- a/wrk2/src/wrk.c +++ b/wrk2/src/wrk.c @@ -970,6 +970,11 @@ static int parse_args(struct config *cfg, char ***urls, struct http_parser_url * return -1; } + if (cfg->rate < cfg->threads){ + fprintf(stderr, "Request per sec must be >= threads\n"); + return -1; + } + for(int i = optind; i