Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@adamgfraser
Copy link
Contributor

After further investigation, it appears that the issue we are having with ZIO Query relates to excessive memory consumption. That is why the performance is so much worse in CI than it is locally and why changing the machine in CI from medium to large has such a performance impact. It appears that although the finalizers can be garbage collected the fact that we are creating such a large data structure with all of these finalizers (~1M in this case) and then have to copy them to an array and sort them as part of releasing them creates excessive memory pressure.

This PR removes the finalizer from the parent scope when the fiber terminates. This seems to dramatically reduce the memory consumption. There may be further optimizations to do to avoid locks but this seems to address the immediate issue.

iravid
iravid previously approved these changes Jun 26, 2020
Copy link
Member

@iravid iravid left a comment

Choose a reason for hiding this comment

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

Simple and easy fix!

@iravid
Copy link
Member

iravid commented Jun 26, 2020

Definitely worth doing RC21-1 with this yeah?

@adamgfraser
Copy link
Contributor Author

Yes. Have we merged any PRs with binary incompatible changes since RC21?

@iravid
Copy link
Member

iravid commented Jun 26, 2020

No, I just went over the changes and they're all binaryu compatible.

@adamgfraser
Copy link
Contributor Author

Yes. Just did the same. Hopefully this will resolve the issues we have been seeing with flakiness on Scala.js in CI. Let's get this in, see if there are any other outstanding PRs we want to get merged, and then get another release out.

@adamgfraser adamgfraser merged commit a8dca4b into zio:master Jun 27, 2020
@adamgfraser adamgfraser deleted the memory branch June 27, 2020 00:06
@jdegoes
Copy link
Member

jdegoes commented Jun 29, 2020

@adamgfraser Awesome work on this! 🙏 🎉

This was referenced Jun 29, 2020
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.

4 participants