Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically configure ThreadPool size based on CPU core count #40

Open
yairgott opened this issue Feb 11, 2025 · 4 comments
Open

Automatically configure ThreadPool size based on CPU core count #40

yairgott opened this issue Feb 11, 2025 · 4 comments
Labels
good first issue Good for newcomers

Comments

@yairgott
Copy link
Collaborator

The ThreadPool size is typically configured according to the number of CPU cores available on the host. Extending the module's startup logic to automatically set the ThreadPool size based on CPU core count, unless explicitly configured, would be a practical enhancement, reducing manual setup and ensuring optimal performance by default.

@yairgott yairgott added the good first issue Good for newcomers label Feb 11, 2025
@dpbnasika
Copy link

@yairgott I could do this as well !!.

From my understanding,
Typically when i run it in my local dev setup after following the developer guide, i see that , during loading time, you are explicitly configuring to make it run in this way:

/path/to/valkey-server "--loadmodule /path/to/libvalkeysearch.so --reader-threads 64 --writer-threads 64".

I ran it with 16 as my vCPU count is 16, so if you do not mention this explicitly, by default it would take 10 and 30 i believe, (correct me if i am wrong), as i also mentioned in the other issue [https://github.com//issues/39], so now this default value has to be configured based on the vCPU count instead of hard coding the writer and reader threads, and support cross platform too to automatically get the the vCPU count. right?.

@yairgott
Copy link
Collaborator Author

Yes, but the ThreadPool size should align with the host's physical cores, not its vCPUs.

@dpbnasika
Copy link

dpbnasika commented Feb 14, 2025

@yairgott does the build run successfully in macos( apple silicon ) currently?, I get errors related to pthread functions. But on linux, i dint face any problem.

@yairgott
Copy link
Collaborator Author

yairgott commented Feb 14, 2025

I've never tried to build in macos and I wouldn't be surprise if it doesn't compile.

The recommended way to develop is using the dev container which is set with Ubuntu 24 IIRC. Please refer to our developer guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants