Skip to content

fix: Set default value for thread keep-alive to 1 minute #594

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

Merged
merged 1 commit into from
Jun 23, 2021

Conversation

jakubjanecek
Copy link
Collaborator

feat: Make blocking thread pool executor configurable

Closes #593

feat: Make blocking thread pool executor configurable

Closes #593
@@ -53,56 +53,71 @@ class ExecutorModule[F[_]: Sync](

object ExecutorModule {

private final val DefaultBlockingExecutorConfig = ThreadPoolExecutorConfig(0, Int.MaxValue, allowCoreThreadTimeout = true)

/** Makes [[com.avast.sst.jvm.execution.ExecutorModule]] with default callback executor and extra [[cats.effect.Blocker]] executor
* for blocking operations.
*/
def makeDefault[F[_]: Sync]: Resource[F, ExecutorModule[F]] = {
for {
numOfCpus <- Resource.eval(Sync[F].delay(Runtime.getRuntime.availableProcessors))
coreSize = numOfCpus * 2
Copy link
Contributor

@sideeffffect sideeffffect Jun 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, I think that this is a bit questionable, but that is for a different debate.

I think you've already seen this before 😸
https://twitter.com/impurepics/status/987758585722621957?lang=en
and
https://github.com/ChristopherDavenport/linebacker

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The theory is that num of CPUs is the right number but in practice (and I've seen this discussed somewhere long in the past) is that a bit higher number might work better. And I think I also got inspired in ZIO runtime. Anyway, I don't think there's much difference so if you show me at least some examples or documents (not just one image ;) ) I think we could change it.

@mergify mergify bot merged commit 35014b5 into master Jun 23, 2021
@mergify mergify bot deleted the fix/593/executors branch June 23, 2021 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Consider adding configuration options for blocking executor to ExecutorModule
2 participants