Skip to content

Instantly share code, notes, and snippets.

@jonasschnelli
Last active April 12, 2018 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonasschnelli/a3eb47147069b99d7c63d7da997b4225 to your computer and use it in GitHub Desktop.
Save jonasschnelli/a3eb47147069b99d7c63d7da997b4225 to your computer and use it in GitHub Desktop.
Bitcoin Core resource profiles

Problem

Bitcoin Core has been designed to synchronise/verify as fast as possible. This is usually desirable, though, on systems where other applications require a reasonable amount of CPU time (ex. desktop systems) the CPU usage maximisation of Bitcoin Core may be intrusive. While it is possible to configure Bitcoin Core to use less resources, it cannot be changed during runtime which leads to unideal user experience.

Concept of profiles

Profiles could help improve the situation by allowing to change the resource consumption profile during runtime.

Ideally, profiles could be recommended configuration sets for different machine- and use-case-types while the detailed settings could be tweaked via a configuration file (user defined resource profiles).

User profiles could work with the following settings (probably more)

-blocksonly
-maxuploadtarget
-maxconnections
-maxmempool
-mempoolexpiry
-minrelaytxfee
-onion
-onlynet
-par
-proxy
-whitelist

Example profiles:

[low bandwidth]: -blocksonly=1, -maxuploadtarget=1 [low cpu]: -par=-1 [private]: -onion=1.2.3.4, -onlynet=onion [own-peer-mode]: -connect=1.2.3.4:8333 -whitelist=1.2.3.4;8333

Painpoints

The current configuration system is not made to be changed during runtime. This will require various refactorings.

Possible implementation steps

  1. Start with an option to disable/enable script verification threads during run-time (low hanging fruit, most obvious usecase)
  2. Refactor a first set of configuration options to allow runtime value changes
  3. Expose configuration overrides via RPC
  4. Add 3 profiles [default], [low-cpu], [low-bandwith] and allow to change them via an RPC call
  5. Allow user-defined configuration profiles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment