Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add resource requests/limits to most applications #396

Merged
merged 14 commits into from
Dec 12, 2023
5 changes: 4 additions & 1 deletion .github/tests/mix-with-tools-mev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ additional_services:
- dora
- prometheus_grafana
- goomy_blob
- full_beaconchain_explorer
#- full_beaconchain_explorer
barnabasbusa marked this conversation as resolved.
Show resolved Hide resolved
- custom_flood
- blobscan
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
mev_type: full
mev_params:
mev_relay_image: flashbots/mev-boost-relay:0.27
4 changes: 3 additions & 1 deletion .github/tests/mix-with-tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ additional_services:
- dora
- prometheus_grafana
- goomy_blob
- full_beaconchain_explorer
#- full_beaconchain_explorer
barnabasbusa marked this conversation as resolved.
Show resolved Hide resolved
- custom_flood
- blobscan
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
17 changes: 10 additions & 7 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ full_beaconchain_explorer = import_module(
)
prometheus = import_module("./src/prometheus/prometheus_launcher.star")
grafana = import_module("./src/grafana/grafana_launcher.star")
mev_boost = import_module("./src/mev_boost/mev_boost_launcher.star")
mock_mev = import_module("./src/mock_mev/mock_mev_launcher.star")
mev_relay = import_module("./src/mev_relay/mev_relay_launcher.star")
mev_flood = import_module("./src/mev_flood/mev_flood_launcher.star")
mev_boost = import_module("./src/mev/mev_boost/mev_boost_launcher.star")
mock_mev = import_module("./src/mev/mock_mev/mock_mev_launcher.star")
mev_relay = import_module("./src/mev/mev_relay/mev_relay_launcher.star")
mev_flood = import_module("./src/mev/mev_flood/mev_flood_launcher.star")
mev_custom_flood = import_module(
"./src/mev_custom_flood/mev_custom_flood_launcher.star"
"./src/mev/mev_custom_flood/mev_custom_flood_launcher.star"
)
eip4788_deployment = import_module(
"./src/eip4788_deployment/eip4788_deployment_launcher.star"
Expand Down Expand Up @@ -244,8 +244,11 @@ def run(plan, args={}):
mev_boost_launcher = mev_boost.new_mev_boost_launcher(
MEV_BOOST_SHOULD_CHECK_RELAY, mev_endpoints
)
mev_boost_service_name = "{0}{1}".format(
input_parser.MEV_BOOST_SERVICE_NAME_PREFIX, index
mev_boost_service_name = "{0}-{1}-{2}-{3}".format(
input_parser.MEV_BOOST_SERVICE_NAME_PREFIX,
index,
participant.cl_client_type,
participant.el_client_type,
)
mev_boost_context = mev_boost.launch(
plan,
Expand Down
10 changes: 10 additions & 0 deletions src/beacon_metrics_gazer/beacon_metrics_gazer_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ USED_PORTS = {
)
}

# The min/max CPU/memory that beacon-metrics-gazer can use
MIN_CPU = 10
MAX_CPU = 500
MIN_MEMORY = 20
MAX_MEMORY = 300


def launch_beacon_metrics_gazer(plan, cl_client_contexts, network_params):
config = get_config(
Expand Down Expand Up @@ -66,4 +72,8 @@ def get_config(ip_addr, http_port_num):
"0.0.0.0",
"-v",
],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
)
10 changes: 10 additions & 0 deletions src/blob_spammer/blob_spammer.star
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ SERVICE_NAME = "blob-spammer"

ENTRYPOINT_ARGS = ["/bin/sh", "-c"]

# The min/max CPU/memory that blob-spammer can use
MIN_CPU = 100
MAX_CPU = 1000
MIN_MEMORY = 20
MAX_MEMORY = 300


def launch_blob_spammer(
plan,
Expand Down Expand Up @@ -58,4 +64,8 @@ def get_config(
]
)
],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
)
45 changes: 44 additions & 1 deletion src/blobscan/blobscan_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,30 @@ API_PORTS = {

ENTRYPOINT_ARGS = ["/bin/sh", "-c"]

# The min/max CPU/memory that blobscan-indexer can use
INDEX_MIN_CPU = 10
INDEX_MAX_CPU = 1000
INDEX_MIN_MEMORY = 32
INDEX_MAX_MEMORY = 1024

# The min/max CPU/memory that blobscan-api can use
API_MIN_CPU = 100
API_MAX_CPU = 1000
API_MIN_MEMORY = 1024
API_MAX_MEMORY = 2048

# The min/max CPU/memory that blobscan-web can use
WEB_MIN_CPU = 100
WEB_MAX_CPU = 1000
WEB_MIN_MEMORY = 512
WEB_MAX_MEMORY = 2048

# The min/max CPU/memory that postgres can use
POSTGRES_MIN_CPU = 10
POSTGRES_MAX_CPU = 1000
POSTGRES_MIN_MEMORY = 32
POSTGRES_MAX_MEMORY = 1024


def launch_blobscan(
plan,
Expand All @@ -42,7 +66,14 @@ def launch_blobscan(
el_client_contexts[0].ip_addr, el_client_contexts[0].rpc_port_num
)

postgres_output = postgres.run(plan, service_name="blobscan-postgres")
postgres_output = postgres.run(
plan,
service_name="blobscan-postgres",
min_cpu=POSTGRES_MIN_CPU,
max_cpu=POSTGRES_MAX_CPU,
min_memory=POSTGRES_MIN_MEMORY,
max_memory=POSTGRES_MAX_MEMORY,
)
api_config = get_api_config(postgres_output.url, beacon_node_rpc_uri, chain_id)
blobscan_config = plan.add_service(API_SERVICE_NAME, api_config)

Expand Down Expand Up @@ -83,6 +114,10 @@ def get_api_config(database_url, beacon_node_rpc, chain_id):
interval="5s",
timeout="5s",
),
min_cpu=API_MIN_CPU,
max_cpu=API_MAX_CPU,
min_memory=API_MIN_MEMORY,
max_memory=API_MAX_MEMORY,
)


Expand All @@ -103,6 +138,10 @@ def get_web_config(database_url, beacon_node_rpc, chain_id):
"CHAIN_ID": chain_id,
},
cmd=["web"],
min_cpu=WEB_MIN_CPU,
max_cpu=WEB_MAX_CPU,
min_memory=WEB_MIN_MEMORY,
max_memory=WEB_MAX_MEMORY,
)


Expand All @@ -119,4 +158,8 @@ def get_indexer_config(beacon_node_rpc, execution_node_rpc, blobscan_api_url):
},
entrypoint=ENTRYPOINT_ARGS,
cmd=[" && ".join(["sleep 90", "/app/blob-indexer"])],
min_cpu=INDEX_MIN_CPU,
max_cpu=INDEX_MAX_CPU,
min_memory=INDEX_MIN_MEMORY,
max_memory=INDEX_MAX_MEMORY,
)
10 changes: 10 additions & 0 deletions src/broadcaster/broadcaster.star
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ IMAGE_NAME = "nethermind/broadcaster:latest"
SERVICE_NAME = "broadcaster"
PORT = 8545

# The min/max CPU/memory that broadcaster can use
MIN_CPU = 100
MAX_CPU = 1000
MIN_MEMORY = 128
MAX_MEMORY = 2048


def launch_broadcaster(plan, all_el_client_contexts):
config = get_config(all_el_client_contexts)
Expand All @@ -15,4 +21,8 @@ def get_config(all_el_client_contexts):
"http://{0}:{1}".format(context.ip_addr, context.rpc_port_num)
for context in all_el_client_contexts
],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
)
4 changes: 2 additions & 2 deletions src/cl/prysm/prysm_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ HTTP_PORT_NUM = 3500
BEACON_MONITORING_PORT_NUM = 8080

# The min/max CPU/memory that the beacon node can use
BEACON_MIN_CPU = 50
BEACON_MAX_CPU = 1000
BEACON_MIN_CPU = 100
BEACON_MAX_CPU = 2000
BEACON_MIN_MEMORY = 256
BEACON_MAX_MEMORY = 1024

Expand Down
9 changes: 9 additions & 0 deletions src/dora/dora_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ DORA_CONFIG_MOUNT_DIRPATH_ON_SERVICE = "/config"
VALIDATOR_RANGES_MOUNT_DIRPATH_ON_SERVICE = "/validator-ranges"
VALIDATOR_RANGES_ARTIFACT_NAME = "validator-ranges"

# The min/max CPU/memory that dora can use
MIN_CPU = 100
MAX_CPU = 1000
MIN_MEMORY = 128
MAX_MEMORY = 2048

USED_PORTS = {
HTTP_PORT_ID: shared_utils.new_port_spec(
Expand Down Expand Up @@ -81,6 +86,10 @@ def get_config(
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_data_files_artifact_uuid,
},
cmd=["-config", config_file_path],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
)


Expand Down
10 changes: 10 additions & 0 deletions src/eip4788_deployment/eip4788_deployment_launcher.star
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
PYTHON_IMAGE = "ethpandaops/python-web3"
EIP4788_DEPLOYMENT_SERVICE_NAME = "eip4788-contract-deployment"

# The min/max CPU/memory that deployer can use
MIN_CPU = 10
MAX_CPU = 100
MIN_MEMORY = 10
MAX_MEMORY = 300


def deploy_eip4788_contract_in_background(plan, sender_key, el_uri):
sender_script = plan.upload_files(
Expand All @@ -17,6 +23,10 @@ def deploy_eip4788_contract_in_background(plan, sender_key, el_uri):
"SENDER_PRIVATE_KEY": sender_key,
"EL_RPC_URI": el_uri,
},
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
),
)

Expand Down
2 changes: 1 addition & 1 deletion src/el/ethereumjs/ethereumjs_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ METRICS_PORT_NUM = 9001

# The min/max CPU/memory that the execution node can use
EXECUTION_MIN_CPU = 100
EXECUTION_MAX_CPU = 1000
EXECUTION_MAX_CPU = 2000
EXECUTION_MIN_MEMORY = 256
EXECUTION_MAX_MEMORY = 1024

Expand Down
8 changes: 4 additions & 4 deletions src/el/geth/geth_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ ENGINE_RPC_PORT_NUM = 8551
METRICS_PORT_NUM = 9001

# The min/max CPU/memory that the execution node can use
EXECUTION_MIN_CPU = 100
EXECUTION_MAX_CPU = 1000
EXECUTION_MIN_MEMORY = 256
EXECUTION_MAX_MEMORY = 1024
EXECUTION_MIN_CPU = 300
EXECUTION_MAX_CPU = 2000
EXECUTION_MIN_MEMORY = 512
EXECUTION_MAX_MEMORY = 2048

# Port IDs
RPC_PORT_ID = "rpc"
Expand Down
10 changes: 10 additions & 0 deletions src/el_forkmon/el_forkmon_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ USED_PORTS = {
)
}

# The min/max CPU/memory that el-forkmon can use
MIN_CPU = 10
MAX_CPU = 100
MIN_MEMORY = 32
MAX_MEMORY = 256


def launch_el_forkmon(
plan,
Expand Down Expand Up @@ -62,6 +68,10 @@ def get_config(config_files_artifact_name):
EL_FORKMON_CONFIG_MOUNT_DIRPATH_ON_SERVICE: config_files_artifact_name,
},
cmd=[config_file_path],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ METRICS_PORT_NUMBER = 9090

DEFAULT_ETHEREUM_METRICS_EXPORTER_IMAGE = "ethpandaops/ethereum-metrics-exporter:0.22.0"

# The min/max CPU/memory that ethereum-metrics-exporter can use
MIN_CPU = 10
MAX_CPU = 100
MIN_MEMORY = 16
MAX_MEMORY = 128


def launch(
plan,
Expand Down Expand Up @@ -42,6 +48,10 @@ def launch(
el_client_context.rpc_port_num,
),
],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
),
)

Expand Down
Loading