Skip to content

how to create new forkjoinpool context like CommonPool #321

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

Closed
Jaware opened this issue Apr 11, 2018 · 7 comments
Closed

how to create new forkjoinpool context like CommonPool #321

Jaware opened this issue Apr 11, 2018 · 7 comments

Comments

@Jaware
Copy link

Jaware commented Apr 11, 2018

in our situation,runtime cpu core size is too large because of the docker,so i want to create new forkjoinpool and use it as the coroutine's running context,there is no docs about how to do that,can anyone show me

@qwwdfsad
Copy link
Member

Currently, there is no such option.
I think we can add configuration via system property for such specific cases

@fvasco
Copy link
Contributor

fvasco commented Apr 11, 2018

Are you looking for something like

ForkJoinPool(2).asCoroutineDispatcher()

However the JVM 10 works well in a container.

@qwwdfsad
Copy link
Member

qwwdfsad commented Apr 11, 2018

The downside of this approach is that now you should explicitly use new dispatcher everywhere.
It may be applicable, but it's not the most convenient option

@Jaware
Copy link
Author

Jaware commented Apr 12, 2018

thanks for your reply,can i use this 'ForkJoinPool(2).asCoroutineDispatcher()' way in production?

@Jaware
Copy link
Author

Jaware commented Apr 12, 2018

our k8 docker cluster use cpu sharing mode with mashine @fvasco ,so the 'Runtime.getRuntime().availableProcessors() ' is not my container's cpu count

@fvasco
Copy link
Contributor

fvasco commented Apr 12, 2018

This was fixed in JVM 10, alternatively you can safety use asCoroutineDispatcher

@Jaware
Copy link
Author

Jaware commented Apr 12, 2018

thanks @fvasco

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

No branches or pull requests

3 participants