Skip to content

Commit e3d83e1

Browse files
authored
Dynamic switch transport (#218)
* temporary solution, allowing users to specify a transport type at application boot * update eval scripts * format
1 parent 9054c0c commit e3d83e1

36 files changed

+152
-79
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Make sure you have libibverbs, librdmacm, libnuma, protoc, libclang, globally available.
66
```
7-
# apt install libclang-dev librdmacm-dev libibverbs-dev protobuf-compiler
7+
# apt install libclang-dev libnuma-dev librdmacm-dev libibverbs-dev protobuf-compiler
88
```
99

1010
Start the phoenix backend service on all servers.

eval/micro-bench/bandwidth/README.md

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ This folder contains scripts for running large RPC bandwidth mircobenchmark.
1010
results under `/tmp/mrpc-eval`.
1111
```
1212
./start_traffic_rdma.sh [/tmp/mrpc-eval]
13-
./start_phoenix_rdma.sh [/tmp/mrpc-eval]
14-
./start_phoenix_tcp.sh [/tmp/mrpc-eval]
1513
./start_traffic_tcp.sh [/tmp/mrpc-eval]
1614
```
1715

eval/micro-bench/bandwidth/phoenix.toml

+3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ transport = "Rdma"
7171
[[modules]]
7272
name = "RpcAdapter"
7373
lib_path = "/tmp/phoenix/plugins/libphoenix_rpc_adapter_plugin.so"
74+
config_string = '''
75+
enable_scheduler = false
76+
'''
7477

7578

7679
[[modules]]

eval/micro-bench/bandwidth/start_phoenix_tcp.sh eval/micro-bench/bandwidth/start_phoenix.sh

-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ fi
66

77
WORKDIR=`dirname $(realpath $0)`
88
cd $WORKDIR
9-
sed -i 's/transport =\(.*\)/transport = "Tcp"/g' phoenix.toml
109
cargo rr --bin launcher -- -o ${OD} --benchmark ./launch_phoenix.toml --configfile ./config.toml --timeout 600

eval/micro-bench/bandwidth/start_traffic_rdma.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ for concurrency in 32; do
1515
sed -i 's/--concurrency [0-9]*/--concurrency '"$concurrency"'/g' ../../../benchmark/benchmark/rpc_bench_tput/*.toml
1616
sed -i 's/-D [0-9]*/-D 10/g' ../../../benchmark/benchmark/rpc_bench_tput/*.toml
1717
sed -i 's/timeout_secs = [0-9]*/timeout_secs = 15/g' ../../../benchmark/benchmark/rpc_bench_tput/*.toml
18-
sed -i 's/transport =\(.*\)/transport = "Rdma"/g' phoenix.toml
18+
sed -i 's/--transport \(rdma\|tcp\)//g' ../../../benchmark/benchmark/rpc_bench_tput/*.toml
19+
sed -i 's/args = "/args = "--transport rdma /g' ../../../benchmark/benchmark/rpc_bench_tput/*.toml
1920
timestamp=$(date +%s%N)
2021

2122
for i in 2kb; do

eval/micro-bench/bandwidth/start_traffic_tcp.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ for concurrency in 128; do
1515
sed -i 's/--concurrency [0-9]*/--concurrency '"$concurrency"'/g' ../../../benchmark/benchmark/rpc_bench_tput/*.toml
1616
# sed -i 's/-D [0-9]*/-D 10/g' ../../../benchmark/benchmark/rpc_bench_tput/*.toml
1717
# sed -i 's/timeout_secs = [0-9]*/timeout_secs = 15/g' ../../../benchmark/benchmark/rpc_bench_tput/*.toml
18-
sed -i 's/transport =\(.*\)/transport = "Tcp"/g' phoenix.toml
18+
sed -i 's/--transport \(rdma\|tcp\)//g' ../../../benchmark/benchmark/rpc_bench_tput/*.toml
19+
sed -i 's/args = "/args = "--transport tcp /g' ../../../benchmark/benchmark/rpc_bench_tput/*.toml
1920
timestamp=$(date +%s%N)
2021

2122
for i in 128b 512b 2kb 8kb 32kb 128kb 512kb 1mb 2mb 8mb; do

eval/micro-bench/rate/README.md

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ scalability.
1111
results under `/tmp/mrpc-eval`.
1212
```
1313
./start_traffic_rdma.sh [/tmp/mrpc-eval]
14-
./start_phoenix_rdma.sh [/tmp/mrpc-eval]
15-
./start_phoenix_tcp.sh [/tmp/mrpc-eval]
1614
./start_traffic_tcp.sh [/tmp/mrpc-eval] [danyang-06]
1715
```
1816

eval/micro-bench/rate/phoenix.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ transport = "Rdma"
7171
[[modules]]
7272
name = "RpcAdapter"
7373
lib_path = "/tmp/phoenix/plugins/libphoenix_rpc_adapter_plugin.so"
74-
74+
config_string = '''
75+
enable_scheduler = false
76+
'''
7577

7678
[[modules]]
7779
name = "TcpRpcAdapter"

eval/micro-bench/rate/start_traffic_rdma.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ cd $workdir
1414
concurrency=32
1515
sed -i 's/--concurrency [0-9]*/--concurrency '"$concurrency"'/g' ../../../benchmark/benchmark/rpc_bench_rate/*.toml
1616
sed -i 's/-D [0-9]*/-D 10/g' ../../../benchmark/benchmark/rpc_bench_rate/*.toml
17-
sed -i 's/timeout_secs = [0-9]*/timeout_secs = 15/g' ../../../benchmark/benchmark/rpc_bench_tput/*.toml
18-
sed -i 's/transport =\(.*\)/transport = "Rdma"/g' phoenix.toml
17+
sed -i 's/--transport \(rdma\|tcp\)//g' ../../../benchmark/benchmark/rpc_bench_rate/*.toml
18+
sed -i 's/args = "/args = "--transport rdma /g' ../../../benchmark/benchmark/rpc_bench_rate/*.toml
1919
timestamp=$(date +%s%N)
2020

2121
for i in 1 2 4 8; do

eval/micro-bench/rate/start_traffic_tcp.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ cd $workdir
1414
concurrency=128
1515
sed -i 's/--concurrency [0-9]*/--concurrency '"$concurrency"'/g' ../../../benchmark/benchmark/rpc_bench_rate/*.toml
1616
sed -i 's/-D [0-9]*/-D 10/g' ../../../benchmark/benchmark/rpc_bench_rate/*.toml
17-
sed -i 's/timeout_secs = [0-9]*/timeout_secs = 15/g' ../../../benchmark/benchmark/rpc_bench_tput/*.toml
18-
sed -i 's/transport =\(.*\)/transport = "Tcp"/g' phoenix.toml
17+
sed -i 's/--transport \(rdma\|tcp\)//g' ../../../benchmark/benchmark/rpc_bench_rate/*.toml
18+
sed -i 's/args = "/args = "--transport tcp /g' ../../../benchmark/benchmark/rpc_bench_rate/*.toml
1919
timestamp=$(date +%s%N)
2020

2121
for i in 1 2 4 8; do

eval/policy/hotel-acl/hotel_reservation.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ timeout_secs = 70
66
[[worker]]
77
host = "danyang-06"
88
bin = "hotel_reservation_server"
9-
args = ""
9+
args = "--transport tcp"
1010

1111
[[worker]]
1212
host = "danyang-05"
1313
bin = "hotel_reservation_client"
14-
args = "-c rdma0.danyang-06 --concurrency 128 -D 65 -i 1"
14+
args = "--transport tcp -c rdma0.danyang-06 --concurrency 128 -D 65 -i 1"
1515
dependencies = [0]

eval/policy/hotel-acl/phoenix.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ transport = "Tcp"
7171
[[modules]]
7272
name = "RpcAdapter"
7373
lib_path = "/tmp/phoenix/plugins/libphoenix_rpc_adapter_plugin.so"
74-
74+
config_string = '''
75+
enable_scheduler = false
76+
'''
7577

7678
[[modules]]
7779
name = "TcpRpcAdapter"

eval/policy/null/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ This folder contains scripts for null policy.
44
1. Start receiver backend on `danyang-06`. Start sender backend on
55
`danyang-05`.
66
```
7-
cjr@danyang-05 $ ./start_phoenix_tcp.sh [/tmp/mrpc-eval]
7+
cjr@danyang-05 $ ./start_phoenix.sh [/tmp/mrpc-eval]
88
```
99

1010
2. Start the rpc_bench_server and rpc_bench_client
1111
```
1212
cjr@danyang-05 $ ./start_traffic_tcp.sh [/tmp/mrpc-eval]
13+
cjr@danyang-05 $ ./start_traffic_rdma.sh [/tmp/mrpc-eval]
1314
```
1415

1516
3. Attach policy at the client and the server

eval/policy/null/phoenix.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ nic_index = 0
7272
[[modules]]
7373
name = "RpcAdapter"
7474
lib_path = "/tmp/phoenix/plugins/libphoenix_rpc_adapter_plugin.so"
75-
75+
config_string = '''
76+
enable_scheduler = false
77+
'''
7678

7779
[[modules]]
7880
name = "TcpRpcAdapter"
File renamed without changes.

eval/policy/null/start_phoenix_rdma.sh

-10
This file was deleted.

eval/policy/null/start_phoenix_tcp.sh

-10
This file was deleted.

eval/policy/null/start_traffic_rdma.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ WORKDIR=$(dirname $(realpath $0))
88
cd $WORKDIR
99

1010
# concurrency = 1
11-
sed -i 's/transport =\(.*\)/transport = "Rdma"/g' phoenix.toml
11+
sed -i 's/--transport \(rdma\|tcp\)//g' ./rpc_bench_latency_64b.toml
12+
sed -i 's/--transport /--transport rdma /g' ./rpc_bench_latency_64b.toml
1213
sed -i 's/TcpRpcAdapterEngine/RpcAdapterEngine/g' attach.toml
1314
cargo rr --bin launcher -- --output-dir ${OD} --benchmark ./rpc_bench_latency_64b.toml --configfile ./config.toml

eval/policy/null/start_traffic_tcp.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ WORKDIR=$(dirname $(realpath $0))
88
cd $WORKDIR
99

1010
# concurrency = 1
11-
sed -i 's/transport =\(.*\)/transport = "Tcp"/g' phoenix.toml
11+
sed -i 's/--transport \(rdma\|tcp\)//g' ./rpc_bench_latency_64b.toml
12+
sed -i 's/--transport /--transport rdma /g' ./rpc_bench_latency_64b.toml
1213
sed -i 's/\"RpcAdapterEngine\"/\"TcpRpcAdapterEngine\"/g' attach.toml
1314
cargo rr --bin launcher -- --output-dir ${OD} --benchmark ./rpc_bench_latency_64b.toml --configfile ./config.toml

eval/policy/qos/phoenix_client.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ transport = "Rdma"
7171
[[modules]]
7272
name = "RpcAdapter"
7373
lib_path = "/tmp/phoenix/plugins/libphoenix_rpc_adapter_plugin.so"
74-
74+
config_string = '''
75+
enable_scheduler = false
76+
'''
7577

7678
[[modules]]
7779
name = "TcpRpcAdapter"

eval/policy/qos/phoenix_server.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ transport = "Rdma"
7171
[[modules]]
7272
name = "RpcAdapter"
7373
lib_path = "/tmp/phoenix/plugins/libphoenix_rpc_adapter_plugin.so"
74-
74+
config_string = '''
75+
enable_scheduler = false
76+
'''
7577

7678
[[modules]]
7779
name = "TcpRpcAdapter"
@@ -92,4 +94,4 @@ name = "Qos"
9294
lib_path = "/tmp/phoenix/plugins/libphoenix_qos_plugin.so"
9395
config_string = '''
9496
latency_budget_microsecs = 10
95-
'''
97+
'''

eval/policy/ratelimit/phoenix.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ transport = "Rdma"
7171
[[modules]]
7272
name = "RpcAdapter"
7373
lib_path = "/tmp/phoenix/plugins/libphoenix_rpc_adapter_plugin.so"
74-
74+
config_string = '''
75+
enable_scheduler = false
76+
'''
7577

7678
[[modules]]
7779
name = "TcpRpcAdapter"

eval/micro-bench/rate/start_phoenix_tcp.sh eval/policy/ratelimit/start_phoenix.sh

-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ fi
66

77
WORKDIR=`dirname $(realpath $0)`
88
cd $WORKDIR
9-
sed -i 's/transport =\(.*\)/transport = "Tcp"/g' phoenix.toml
109
cargo rr --bin launcher -- -o ${OD} --benchmark ./launch_phoenix.toml --configfile ./config.toml --timeout 600

eval/policy/ratelimit/start_phoenix_rdma.sh

-10
This file was deleted.

eval/policy/ratelimit/start_phoenix_tcp.sh

-10
This file was deleted.

src/ipc/mrpc/src/control_plane.rs

+15-12
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,27 @@ use serde::{Deserialize, Serialize};
22

33
type IResult<T> = Result<T, interface::Error>;
44

5-
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
5+
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default)]
66
pub enum TransportType {
77
#[serde(alias = "Rdma")]
88
Rdma,
9+
#[default]
910
#[serde(alias = "Tcp")]
1011
Tcp,
1112
}
1213

14+
impl std::str::FromStr for TransportType {
15+
type Err = &'static str;
16+
17+
fn from_str(s: &str) -> Result<Self, Self::Err> {
18+
match s.to_uppercase().as_str() {
19+
"RDMA" => Ok(Self::Rdma),
20+
"TCP" => Ok(Self::Tcp),
21+
_ => Err("Expect RDMA or TCP"),
22+
}
23+
}
24+
}
25+
1326
#[derive(Debug, Clone, Serialize, Deserialize)]
1427
pub enum Request {}
1528

@@ -20,7 +33,7 @@ pub enum ResponseKind {}
2033
pub struct Response(pub IResult<ResponseKind>);
2134

2235
/// Service setting. Each use thread can have its own service setting.
23-
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
36+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)]
2437
pub struct Setting {
2538
/// The transport to use.
2639
pub transport: TransportType,
@@ -30,13 +43,3 @@ pub struct Setting {
3043
/// Set when the user thread binds to a CPU core.
3144
pub core_id: Option<usize>,
3245
}
33-
34-
impl Default for Setting {
35-
fn default() -> Self {
36-
Setting {
37-
transport: TransportType::Rdma,
38-
nic_index: 0,
39-
core_id: None,
40-
}
41-
}
42-
}

src/phoenix/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,5 @@ unique = "0.9.1"
5858
sharded-slab = "0.1.4"
5959
libnuma = "0.0.4"
6060
libnuma-sys = "0.0.4"
61+
62+
serde_json = "1.0.81"

0 commit comments

Comments
 (0)