typelevel / typelevel/cats-effect

Dynamically resize the WSTP if `availableProcessors()` changes

Open
#3,909 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

:microscope: experiment
Dominant language
Scala
Stars
2.2k
Forks
576
Avg merge
2d 11h
Merged PRs (30d)
18

Description

We currently rely on Runtime#availableProcessors to size the work-stealing threadpool. The JavaDoc warns that

Applications that are sensitive to the number of available processors should therefore occasionally poll this property and adjust their resource usage appropriately.

A concrete example of an environment where the number of available processors may change is Kubernetes with the Vertical Pod Autoscaler.

The Kubernetes Vertical Pod Autoscaler automatically adjusts the CPU and memory reservations for your Pods to help "right size" your applications.

Marking as "experiment" since this would be a non-trivial enhancement :) and maybe not worth the complexity.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the work-stealing thread pool is sized from Runtime#availableProcessors and how that pool is managed in cats-effect. Review the Kubernetes Vertical Pod Autoscaler example for the processor changes this must handle. Done should mean the WSTP adjusts when availableProcessors() changes, with behavior and complexity validated before treating the experiment as worthwhile.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.