Skip to content

Commit

Permalink
🔨update demo script and README
Browse files Browse the repository at this point in the history
  • Loading branch information
Lord-Turmoil committed Nov 30, 2024
1 parent aa87c00 commit b525127
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,22 @@ int main()
## The Demo

The example above might be a little too simple. For a more comprehensive demonstration, you can see the demo server under `demo/`. To see it live, use the following commands. It will run the demo server, and send some dummy requests to it.
The example above might be a little too simple. For a more comprehensive demonstration, you can see the demo server under `demo/`. To see it live, use the following commands. It will run the demo server, and send some dummy requests to it. There are two server options available. And the client will launch 4 processes to send requests at the same time.

```bash
# build and run the demo server
./script/demo.sh server
./script/demo.sh server # run with Basic server
./script/demo.sh server mayhem # run with Mayhem server

# in another terminal
./script/demo.sh client
./script/demo.sh client # 4 processes, each sending 10 requests
./script/demo.sh client N # 4 processes, each sending N requests
```

Basic server handles requests in one thread, so you'll see the client return one response at a time. Mayhem server handles requests asynchronously, so you'll see a significant speedup in the client.

The configuration files are also provided in `demo/`, you can modify them to see the effects.

> [!TIP]
>
> By default, the server launch at `http://localhost:5000`, so make sure this port isn't blocked or occupied. And the demo client uses `curl` to send requests.
Expand Down
5 changes: 4 additions & 1 deletion scripts/demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function run_client() {
send_requests $ROUND
fi
else
ROUND=${1:-5}
ROUND=${1:-10}
bash $0 client _ 2 $ROUND
fi
}
Expand All @@ -78,4 +78,7 @@ elif [ "$option" == "client" ]; then
run_client $@
else
echo "Usage: $0 [server|client] [args]"
echo " server - run with Basic server"
echo " server mayhem - run with Mayhem server"
echo " client N - 4 processes, each sends N requests"
fi

0 comments on commit b525127

Please sign in to comment.