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

Clean-up Blocking operations Docs #7834

Merged
merged 3 commits into from
Feb 16, 2023

Conversation

khajavi
Copy link
Member

@khajavi khajavi commented Feb 15, 2023

Also fixes #7653

ZIO has a separate **blocking thread pool** specially designed for **Blocking I/O** and, also **CPU Work** workloads. We should run blocking workloads on this thread pool by using `ZIO.blocking` or `ZIO.attemptBlocking*` constructors to prevent interfering with the primary thread pool.

:::note
ZIO has an auto-blocking mechanism that detects blocking operations and runs them on a separate blocking thread pool. However, it is recommended to import blocking side effects.
Copy link
Member

Choose a reason for hiding this comment

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

"side effect" terminology is deprecated and should be removed, here and elsewhere.

Copy link
Member Author

Choose a reason for hiding this comment

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

@jdegoes Can you elaborate more on this?

Copy link
Contributor

@adamgfraser adamgfraser Feb 15, 2023

Choose a reason for hiding this comment

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

@khajavi The concept of "side effects" comes from functional programming and does not make sense to developers coming from other backgrounds. We have taken significant steps to make this concept not relevant. For example ZIO.succeed accepts a by name parameter so you use ZIO.succeed whether the body is side effecting or not. We are trying to "dissolve" the concept of side effects.

So I would rewrite this along the lines of:

"ZIO has an auto-blocking mechanism that detects blocking operations and runs them on a separate blocking thread pool. However, if you know that some code is blocking you can use the ZIO.blocking constructor to give a "hint" of this to the ZIO runtime."

@jdegoes jdegoes merged commit e9ca719 into zio:series/2.x Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs mistake
3 participants