0

After successfully with previous question, where I tried to make cardano-node and cardano-db-sync run as a services, I tried to play around with +RTS ... -RTS option on cardano-db-sync, specifically to reduce the RAM consumption with some option.

Here's the RTS option I tried +RTS -N2 -A16m -qa -qb -qg -M6000M -RTS.

With cardano-node run ..., I can do above RTS options, but with cardano-db-sync ..., I couldn't, here's the sample command

...
...
...
PGPASSFILE=${PGPASSFILE} cardano-db-sync +RTS -N2 -A16m -qa -qb -qg -M4500M -RTS --config ${CONFIG} --socket-path ${CARDANO_NODE_SOCKET_PATH} --state-dir ${STATE_DIR} --schema-dir ${SCHEMA_DIR}

But, it fails, the error shown as below

Mar 08 09:54:54 cardano-db-sync: Most RTS options are disabled. Link with -rtsopts to enable them.
Mar 08 09:54:54 cardano-db-sync-run.service: Main process exited, code=exited, status=1/FAILURE
Mar 08 09:54:54 cardano-db-sync-run.service: Failed with result 'exit-code'.

I tried to add -rtsopts as suggested on that error, but it also fails

PGPASSFILE=${PGPASSFILE} cardano-db-sync +RTS -N2 -A16m -qa -qb -qg -M4500M -RTS -rtsopts --config ${CONFIG} --socket-path ${CARDANO_NODE_SOCKET_PATH} --state-dir ${STATE_DIR} --schema-dir ${SCHEMA_DIR}

Same error is shown

cardano-db-sync: Most RTS options are disabled. Link with -rtsopts to enable them.

Also, I tried to do that with another way (reference - on official documentation), -with-rtsopts="-N2 -A16m -qa -qb -qg -M6000M", but it also fails with error, as shown below

Invalid option `-with-rtsopts=-N2 -A16m -qa -qb -qg -M4500M'


Is it possible to add the options +RTS ... -RTS like I tried above?

Or, am I did wrong? Like, it must come sequentially right after/before some command?

Thanks in advance! And, have a great day!



*PS
  • The reason I did try to reduce the RAM consumption is because cardano-node run and cardano-db-sync keeps dropped (killed) from the services, since I had limited RAM (16GB) on my test server. I kinda aware with RAM requirement, but I tried to reduce it, due some circumstances, I can't upgrade RAM on my test server, since it has cardano node running too.

  • I'm not GHC expert or even linux expert. So, if there's some terms or RTS option that I use incorrectly, please let me know, so I can do in a correct way. :)

8
  • I am the main developer on db-sync. Trying to reduce the memory footprint of db-sync using RTS options will fail with 100% certainty. The problem is that both node and db-sync have a data structure called ledger state (which is huge, like 8 Gigabytes huge) that is basically identical. Long term, we want to reduce that so that db-sync does not need to maintain that. Until then, you need to just live with the high memory usage. Mar 9, 2022 at 11:14
  • Hi @ErikdeCastroLopo - thanks for your comment & explanation. Want to confirm for your statement - "Trying to reduce the memory footprint of db-sync using RTS options will fail with 100% certainty." - is that meant I couldn't use RTS options, like I used on cardano-node run? || And, "Until then, you need to just live with the high memory usage." - you mean, the only way is to upgrade RAM?
    – wandyyd
    Mar 10, 2022 at 16:10
  • RTS options might allow you to shave as much as 20% off the memory usage at the cost of a performance hit (because the garbage collector will need to run more often). Unfortunately the only current solution is more RAM. Mar 10, 2022 at 21:36
  • Do you know what RTS options that might be available for me to use? since, from what I test around from initial options +RTS -N2 -A16m -qa -qb -qg -M6000M -RTS it gives me error message Most RTS options are disabled. Link with -rtsopts to enable them.. Anyway, thanks for your comments.
    – wandyyd
    Mar 11, 2022 at 1:49
  • 1
    Oh, sorry, RTS opts are disabled by default in the db-sync build. To enable it add -rtsopts after -with-rtsopts=-N3 for the cardano-db-sync executable in the file cardano-db-sync/cardano-db-sync.cabal Mar 11, 2022 at 1:58

1 Answer 1

2

RTS opts are disabled by default in the db-sync build. To enable it add -rtsopts after -with-rtsopts=-N3 for the cardano-db-sync executable in the file cardano-db-sync/cardano-db-sync.cabal.

1
  • thanks for this! hope the others will got help in the future!
    – wandyyd
    Mar 13, 2022 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.