Skip to content

Commit 70de4e2

Browse files
committed
fix: makes parsec endpoint names scalable; fixes #312
Signed-off-by: Morgan Rockett <[email protected]>
1 parent 96062b5 commit 70de4e2

5 files changed

+31
-21
lines changed

docker-compose-parsec-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ services:
99
image: opencbdc-tx-parsec
1010
platform: linux/amd64
1111
tty: true
12-
command: ./scripts/wait-for-it.sh -s agent0:8080 -t 60 -- ./build/tools/bench/parsec/evm/evm_bench --shard_count=1 --shard0_count=1 --shard00_endpoint=shard0:5556 --node_id=0 --component_id=0 --agent_count=1 --agent0_endpoint=agent0:8080 --ticket_machine_count=1 --ticket_machine0_endpoint=ticket0:7777 --loadgen_accounts=8192 --loadgen_txtype=erc20 --telemetry=1
12+
command: ./scripts/wait-for-it.sh -s agent0:8080 -t 60 -- ./build/tools/bench/parsec/evm/evm_bench --shard_count=1 --shard0_count=1 --shard0_0_endpoint=shard0:5556 --node_id=0 --component_id=0 --agent_count=1 --agent0_endpoint=agent0:8080 --ticket_machine_count=1 --ticket_machine0_endpoint=ticket0:7777 --loadgen_accounts=8192 --loadgen_txtype=erc20 --telemetry=1
1313
networks:
1414
- parsec-network
1515
healthcheck:

docker-compose-parsec.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
platform: linux/amd64
1111
tty: true
1212
restart: always
13-
command: ./scripts/wait-for-it.sh -s ticket0:7777 -t 60 -- ./scripts/wait-for-it.sh -s shard0:5556 -t 60 -- ./build/src/parsec/agent/agentd --shard_count=1 --shard0_count=1 --shard00_endpoint=shard0:5556 --node_id=0 --component_id=0 --agent_count=1 --agent0_endpoint=agent0:8080 --ticket_machine_count=1 --ticket_machine0_endpoint=ticket0:7777 --loglevel=WARN --runner_type="evm"
13+
command: ./scripts/wait-for-it.sh -s ticket0:7777 -t 60 -- ./scripts/wait-for-it.sh -s shard0:5556 -t 60 -- ./build/src/parsec/agent/agentd --shard_count=1 --shard0_count=1 --shard0_0_endpoint=shard0:5556 --node_id=0 --component_id=0 --agent_count=1 --agent0_endpoint=agent0:8080 --ticket_machine_count=1 --ticket_machine0_endpoint=ticket0:7777 --loglevel=WARN --runner_type="evm"
1414
ports:
1515
- 8080:8080
1616
networks:
@@ -28,7 +28,7 @@ services:
2828
image: opencbdc-tx-parsec
2929
platform: linux/amd64
3030
tty: true
31-
command: ./scripts/wait-for-it.sh -s shard0:5556 -t 60 -- ./build/src/parsec/ticket_machine/ticket_machined --shard_count=1 --shard0_count=1 --shard00_endpoint=shard0:5556 --node_id=0 --component_id=0 --agent_count=1 --agent0_endpoint=agent0:6666 --ticket_machine_count=1 --ticket_machine0_endpoint=ticket0:7777 --loglevel=WARN
31+
command: ./scripts/wait-for-it.sh -s shard0:5556 -t 60 -- ./build/src/parsec/ticket_machine/ticket_machined --shard_count=1 --shard0_count=1 --shard0_0_endpoint=shard0:5556 --node_id=0 --component_id=0 --agent_count=1 --agent0_endpoint=agent0:6666 --ticket_machine_count=1 --ticket_machine0_endpoint=ticket0:7777 --loglevel=WARN
3232
networks:
3333
- parsec-network
3434
healthcheck:
@@ -45,7 +45,7 @@ services:
4545
image: opencbdc-tx-parsec
4646
platform: linux/amd64
4747
tty: true
48-
command: ./build/src/parsec/runtime_locking_shard/runtime_locking_shardd --shard_count=1 --shard0_count=1 --shard00_endpoint=shard0:5556 --node_id=0 --component_id=0 --agent_count=1 --agent0_endpoint=agent0:6666 --ticket_machine_count=1 --ticket_machine0_endpoint=ticket0:7777 --loglevel=WARN
48+
command: ./build/src/parsec/runtime_locking_shard/runtime_locking_shardd --shard_count=1 --shard0_count=1 --shard0_0_endpoint=shard0:5556 --node_id=0 --component_id=0 --agent_count=1 --agent0_endpoint=agent0:6666 --ticket_machine_count=1 --ticket_machine0_endpoint=ticket0:7777 --loglevel=WARN
4949
networks:
5050
- parsec-network
5151
healthcheck:

scripts/lua_bench.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ for arg in "$@"; do
3030
done
3131
./build/tools/bench/parsec/lua/lua_bench --component_id=0 \
3232
--ticket_machine0_endpoint=$IP:7777 --ticket_machine_count=1 \
33-
--shard_count=1 --shard0_count=1 --shard00_endpoint=$IP:5556 \
33+
--shard_count=1 --shard0_count=1 --shard0_0_endpoint=$IP:5556 \
3434
--agent_count=1 --agent0_endpoint=$IP:$PORT \
3535
--loglevel=$LOGLEVEL scripts/gen_bytecode.lua $N_WALLETS
3636
echo done

scripts/parsec-run-local.sh

+18-15
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,26 @@ echo Running agent on $IP:$PORT
4141
echo Log level = $LOGLEVEL
4242
echo Runner type = $RUNNER_TYPE
4343

44-
./build/src/parsec/runtime_locking_shard/runtime_locking_shardd --shard_count=1 \
45-
--shard0_count=1 --shard00_endpoint=$IP:5556 \
46-
--shard00_raft_endpoint=$IP:5557 --node_id=0 --component_id=0 \
47-
--agent_count=1 --agent0_endpoint=$IP:6666 --ticket_machine_count=1 \
48-
--ticket_machine0_endpoint=$IP:7777 --loglevel=$LOGLEVEL \
49-
> logs/shardd.log &
44+
./build/src/parsec/runtime_locking_shard/runtime_locking_shardd \
45+
--shard_count=1 --shard0_count=1 --shard0_0_endpoint=$IP:5556 \
46+
--node_id=0 --component_id=0 \
47+
--agent_count=1 --agent0_endpoint=$IP:6666 \
48+
--ticket_machine_count=1 --ticket_machine0_endpoint=$IP:7777 \
49+
--loglevel=$LOGLEVEL > logs/shardd.log &
5050
sleep 1
5151
./scripts/wait-for-it.sh -s $IP:5556 -t 60 -- \
52-
./build/src/parsec/ticket_machine/ticket_machined --shard_count=1 \
53-
--shard0_count=1 --shard00_endpoint=$IP:5556 --node_id=0 \
54-
--component_id=0 --agent_count=1 --agent0_endpoint=$IP:6666 \
52+
./build/src/parsec/ticket_machine/ticket_machined \
53+
--shard_count=1 --shard0_count=1 --shard0_0_endpoint=$IP:5556 \
54+
--node_id=0 --component_id=0 \
55+
--agent_count=1 --agent0_endpoint=$IP:6666 \
5556
--ticket_machine_count=1 --ticket_machine0_endpoint=$IP:7777 \
5657
--loglevel=$LOGLEVEL > logs/ticket_machined.log &
5758
sleep 1
58-
./scripts/wait-for-it.sh -s $IP:7777 -t 60 -- ./scripts/wait-for-it.sh -s \
59-
$IP:5556 -t 60 -- ./build/src/parsec/agent/agentd --shard_count=1 \
60-
--shard0_count=1 --shard00_endpoint=$IP:5556 --node_id=0 --component_id=0 \
61-
--agent_count=1 --agent0_endpoint=$IP:$PORT --ticket_machine_count=1 \
62-
--ticket_machine0_endpoint=$IP:7777 --loglevel=$LOGLEVEL \
63-
--runner_type=$RUNNER_TYPE > logs/agentd.log &
59+
./scripts/wait-for-it.sh -s $IP:7777 -t 60 -- \
60+
./scripts/wait-for-it.sh -s $IP:5556 -t 60 -- \
61+
./build/src/parsec/agent/agentd \
62+
--shard_count=1 --shard0_count=1 --shard0_0_endpoint=$IP:5556 \
63+
--node_id=0 --component_id=0 \
64+
--agent_count=1 --agent0_endpoint=$IP:$PORT \
65+
--ticket_machine_count=1 --ticket_machine0_endpoint=$IP:7777 \
66+
--loglevel=$LOGLEVEL --runner_type=$RUNNER_TYPE > logs/agentd.log &

src/parsec/util.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#include <future>
99
#include <unordered_map>
10+
#include <regex>
11+
1012

1113
namespace cbdc::parsec {
1214
auto split(const std::string& s, const std::string& delim)
@@ -60,7 +62,12 @@ namespace cbdc::parsec {
6062
auto count = std::stoull(it->second);
6163

6264
for(size_t i = 0; i < count; i++) {
63-
auto ep_key = component_name + std::to_string(i) + "_endpoint";
65+
auto ep_key = component_name;
66+
std::regex shard_ep_pattern("^shard[0-9]+$");
67+
if (std::regex_match(component_name, shard_ep_pattern)) {
68+
ep_key += "_";
69+
}
70+
ep_key += std::to_string(i) + "_endpoint";
6471
it = opts.find(ep_key);
6572
if(it == opts.end()) {
6673
return std::nullopt;

0 commit comments

Comments
 (0)