Skip to content

[feat]: Use nproc -X procs for database compaction events #51

Description

@gStart9

Prerequisites

  • I have searched for existing issues that already suggest this feature.

Describe the Feature Request

Greatly speed up db compaction on SSDs by using multiple CPU cores.

Describe the Use Case

Users with multiple CPU cores and SSDs.
This will greatly speed up compaction as of electrs v0.8.10:
romanz/electrs#1138

Describe Preferred Solution

4 is probably a good number of processor cores to leave available (that leaves at least 2 cores with cache available for all other containers)

Selection of number to set db_parallelism to in electrs.toml something like:

if [[ $(nproc) -gt 4 ]]
then
 electrs_use_procs=$(expr $(nproc) - 4)
else
 electrs_use_procs=1
fi
echo $electrs_use_procs

Equivalent typescript (assuming we can call nproc):

const totalCores = parseInt(await compat.mod("nproc"), 10);
const adjustedCores = totalCores > 4 ? totalCores - 4 : 1;

Describe Alternatives

Alternative is to leave it at the default (1)

Anything else?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions