2.1 KiB
2.1 KiB
Performance Optimization Guidance
This is a reference benchmark process document designed to assist in performance analysis and optimization for client. This document provides as general a testing framework as possible, allowing developers with needs to adjust it according to their specific circumstances across various platform.
Flow
Preparation
Step 1: Setup Dragonfly
- Please refer to official doc.
Step 2: Start a file server
- Start with docker:
export FILE_SERVER_PORT=12345
docker run -d --rm -p ${FILE_SERVER_PORT}:80 --name dragonfly-fs dragonflyoss/file-server:latest
- Check the file server is ready:
# return success if ready
curl -s -o /dev/null \
-w "%{http_code}" \
http://localhost:12345/nano \
| grep -q "200" \
&& echo "Success" \
|| echo "Failed"
- Optional:
you can build your own image, take a reference from Dockerfile.
Step 3: Install test tools
- Request Generator: oha
brew install oha
- Profiling: flamegraph
cargo install flamegraph
Step 4: Setup Dragonfly Peer
Document: Install with binary.
- Compile the target binary
cargo build --release --bin dfdaemon
- Connect to Dragonfly
# prepare client.yaml by yourself.
./target/release/dfdaemon --config client.yaml -l info --verbose
FlameGraph
Now, let's start benchmark with the following params:
- $FILE_SERVER_ADDRESS
- $CLIENT_PROXY_ADDRESS
Collect Flamegraph
- Capture the flamegraph:
## stop after all requests done.
sudo flamegraph -o my_flamegraph.svg --pid 3442
- Make the request:
oha -c 1000 \
-n 100 \
--rand-regex-url $FILE_SERVER_ADDRESS/\(nano\|micro\|small\|medium\|large\) \
-x $CLIENT_PROXY_ADDRESS
