input-output-hk / daedalus

The open source cryptocurrency wallet for ada, built to grow with the community
https://daedaluswallet.io/
Apache License 2.0
1.23k stars 297 forks source link

[FR]: Allow for easier specification of RTS options #3154

Open Fjodor42 opened 8 months ago

Fjodor42 commented 8 months ago

As somewhat described in https://github.com/IntersectMBO/cardano-node/issues/5500, I saw time from Daedalus startup to full functionality on the order of 4+ hours, further exacerbated by frequent disconnections from mainnet, necessitating a restart of cardano-node.

Jumping through some hacky hoops, I managed to pass on other Haskell RTS options than the ones I since learned where offered in the GUI for low-memory systems, to discover not only how to utilise more than one core, but that this had the following effects:

  1. Start-up to full functionality is now on the order of 10 - 20 minutes as opposed to 4+ hours
  2. Whereas earlier, Daedalus would lose connection to mainnet on a daily basis, I haven't seen that for a few days now

Wading through the quagmires of a compiled Nix package was dreary, so I shall not be making PR, but I would propose to implement a way for the user to specify arbitrary RTS options, as well as to provide reasonable defaults (still overridable), depending on CPU core count.

michalrus commented 8 months ago

Hey @Fjodor42, could you share which RTS options you ran with, so that we can test their effects? :) Thank you for this investigation!

Fjodor42 commented 8 months ago

Hi @michalrus,

Opting for another approach than just specifying +RTS -N -RTS which would utilise all available CPU cores, I opted for half the amount of physical cores in my machine with +RTS -N14 -RTS.

Since then, I lowered that to +RTS -N8 -RTS to utilize only 8 cores, and realising that some people, myself included, would very much like to not have any single program utilise all cores "nilly-willy", my suggestion is to apply some heuristic such as, say, half or a quarter of available physical or logical cores, but then let the user alter those parameters at will.