Skip to content

Commit

Permalink
fix: makes parsec endpoint names scalable; fixes mit-dci#312
Browse files Browse the repository at this point in the history
Signed-off-by: Morgan Rockett <[email protected]>
  • Loading branch information
rockett-m committed Nov 27, 2024
1 parent 96062b5 commit 70de4e2
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 21 deletions.
2 changes: 1 addition & 1 deletion docker-compose-parsec-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
image: opencbdc-tx-parsec
platform: linux/amd64
tty: true
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
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
networks:
- parsec-network
healthcheck:
Expand Down
6 changes: 3 additions & 3 deletions docker-compose-parsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
platform: linux/amd64
tty: true
restart: always
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"
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"
ports:
- 8080:8080
networks:
Expand All @@ -28,7 +28,7 @@ services:
image: opencbdc-tx-parsec
platform: linux/amd64
tty: true
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
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
networks:
- parsec-network
healthcheck:
Expand All @@ -45,7 +45,7 @@ services:
image: opencbdc-tx-parsec
platform: linux/amd64
tty: true
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
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
networks:
- parsec-network
healthcheck:
Expand Down
2 changes: 1 addition & 1 deletion scripts/lua_bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ for arg in "$@"; do
done
./build/tools/bench/parsec/lua/lua_bench --component_id=0 \
--ticket_machine0_endpoint=$IP:7777 --ticket_machine_count=1 \
--shard_count=1 --shard0_count=1 --shard00_endpoint=$IP:5556 \
--shard_count=1 --shard0_count=1 --shard0_0_endpoint=$IP:5556 \
--agent_count=1 --agent0_endpoint=$IP:$PORT \
--loglevel=$LOGLEVEL scripts/gen_bytecode.lua $N_WALLETS
echo done
33 changes: 18 additions & 15 deletions scripts/parsec-run-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,26 @@ echo Running agent on $IP:$PORT
echo Log level = $LOGLEVEL
echo Runner type = $RUNNER_TYPE

./build/src/parsec/runtime_locking_shard/runtime_locking_shardd --shard_count=1 \
--shard0_count=1 --shard00_endpoint=$IP:5556 \
--shard00_raft_endpoint=$IP:5557 --node_id=0 --component_id=0 \
--agent_count=1 --agent0_endpoint=$IP:6666 --ticket_machine_count=1 \
--ticket_machine0_endpoint=$IP:7777 --loglevel=$LOGLEVEL \
> logs/shardd.log &
./build/src/parsec/runtime_locking_shard/runtime_locking_shardd \
--shard_count=1 --shard0_count=1 --shard0_0_endpoint=$IP:5556 \
--node_id=0 --component_id=0 \
--agent_count=1 --agent0_endpoint=$IP:6666 \
--ticket_machine_count=1 --ticket_machine0_endpoint=$IP:7777 \
--loglevel=$LOGLEVEL > logs/shardd.log &
sleep 1
./scripts/wait-for-it.sh -s $IP:5556 -t 60 -- \
./build/src/parsec/ticket_machine/ticket_machined --shard_count=1 \
--shard0_count=1 --shard00_endpoint=$IP:5556 --node_id=0 \
--component_id=0 --agent_count=1 --agent0_endpoint=$IP:6666 \
./build/src/parsec/ticket_machine/ticket_machined \
--shard_count=1 --shard0_count=1 --shard0_0_endpoint=$IP:5556 \
--node_id=0 --component_id=0 \
--agent_count=1 --agent0_endpoint=$IP:6666 \
--ticket_machine_count=1 --ticket_machine0_endpoint=$IP:7777 \
--loglevel=$LOGLEVEL > logs/ticket_machined.log &
sleep 1
./scripts/wait-for-it.sh -s $IP:7777 -t 60 -- ./scripts/wait-for-it.sh -s \
$IP:5556 -t 60 -- ./build/src/parsec/agent/agentd --shard_count=1 \
--shard0_count=1 --shard00_endpoint=$IP:5556 --node_id=0 --component_id=0 \
--agent_count=1 --agent0_endpoint=$IP:$PORT --ticket_machine_count=1 \
--ticket_machine0_endpoint=$IP:7777 --loglevel=$LOGLEVEL \
--runner_type=$RUNNER_TYPE > logs/agentd.log &
./scripts/wait-for-it.sh -s $IP:7777 -t 60 -- \
./scripts/wait-for-it.sh -s $IP:5556 -t 60 -- \
./build/src/parsec/agent/agentd \
--shard_count=1 --shard0_count=1 --shard0_0_endpoint=$IP:5556 \
--node_id=0 --component_id=0 \
--agent_count=1 --agent0_endpoint=$IP:$PORT \
--ticket_machine_count=1 --ticket_machine0_endpoint=$IP:7777 \
--loglevel=$LOGLEVEL --runner_type=$RUNNER_TYPE > logs/agentd.log &
9 changes: 8 additions & 1 deletion src/parsec/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include <future>
#include <unordered_map>
#include <regex>


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

for(size_t i = 0; i < count; i++) {
auto ep_key = component_name + std::to_string(i) + "_endpoint";
auto ep_key = component_name;
std::regex shard_ep_pattern("^shard[0-9]+$");
if (std::regex_match(component_name, shard_ep_pattern)) {
ep_key += "_";
}
ep_key += std::to_string(i) + "_endpoint";
it = opts.find(ep_key);
if(it == opts.end()) {
return std::nullopt;
Expand Down

0 comments on commit 70de4e2

Please sign in to comment.