Skip to content

Commit

Permalink
Merge pull request #804 from input-output-hk/jhbertra/decrease-indexe…
Browse files Browse the repository at this point in the history
…r-batching

Fix chain-indexer memory issues.
  • Loading branch information
jhbertra authored Jan 18, 2024
2 parents 22354d7 + faf0c22 commit 9ac3b29
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion marlowe-chain-sync/marlowe-chain-indexer/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ parseOptions defaultNetworkId defaultSocketPath defaultDatabaseUri version = O.i
O.option O.auto $
mconcat
[ O.long "max-cost"
, O.value 1_000_000
, O.value 250_000
, O.metavar "COST_UNITS"
, O.help
"The maximum number of cost units that can be batched when persisting blocks. If the cost of the current batch would exceed this value, the chain sync client will wait until the current batch is persisted before requesting another block."
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Changed

- Default batch size for chain-indexer decreased to 1/4 to prevent OOM errors.
9 changes: 9 additions & 0 deletions nix/marlowe-cardano/deploy/operables.nix
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ in
#################
# OTEL_EXPORTER_OTLP_ENDPOINT: The url of the open telemetry collector
# OTEL_SERVICE_NAME: The name of the open telemetry service
# BLOCK_COST: The number of cost units to associate with persisting a block
# TX_COST: The number of cost units to associate with persisting a transaction
# MAX_COST: The maximum cost of work to batch before committing
[ -z "''${NODE_CONFIG:-}" ] && echo "NODE_CONFIG env var must be set -- aborting" && exit 1
[ -z "''${CARDANO_NODE_SOCKET_PATH:-}" ] && echo "CARDANO_NODE_SOCKET_PATH env var must be set -- aborting" && exit 1
Expand Down Expand Up @@ -206,13 +209,19 @@ in
${wait-for-socket}/bin/wait-for-socket "$CARDANO_NODE_SOCKET_PATH"
export OTEL_SERVICE_NAME="''${OTEL_SERVICE_NAME:-marlowe-chain-indexer}"
export BLOCK_COST="''${BLOCK_COST:-1}"
export TX_COST="''${TX_COST:-10}"
export MAX_COST="''${MAX_COST:-250000}"
${marlowe-chain-indexer}/bin/marlowe-chain-indexer \
--socket-path "$CARDANO_NODE_SOCKET_PATH" \
--database-uri "$DATABASE_URI" \
--shelley-genesis-config-file "$SHELLEY_GENESIS_CONFIG" \
--genesis-config-file "$BYRON_GENESIS_CONFIG" \
--genesis-config-file-hash "$BYRON_GENESIS_HASH" \
--block-cost "$BLOCK_COST" \
--tx-cost "$TX_COST" \
--max-cost "$MAX_COST" \
--http-port "$HTTP_PORT"
'';
};
Expand Down

0 comments on commit 9ac3b29

Please sign in to comment.