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

PsiStore operations on very big stores leads to running out of memory. #207

Open
xiangzhi opened this issue Nov 8, 2021 · 4 comments
Open

Comments

@xiangzhi
Copy link
Contributor

xiangzhi commented Nov 8, 2021

I have a 2 hour length, 426 GB PsiStore. As part of my post study process, I wanted to remove a stream and save the store in another location for deep storage. The code is basically as following:

var outputStorePath = Path.Combine(@"D:\Hallway-Recording-Clean", datasetID, sessionID);
PsiStore.Copy((partition.StoreName, partition.StorePath), (partition.StoreName,outputStorePath), null, s => s.Name.Contains("ir"), false);

When I run the code, the memory usage slowly goes up and eventually my system run out of memory (I have 64 GB of RAM) and the application crashes. I think I could just change the pipeline to use real time which should work but it means I have to wait 2 hours for it to finish.

Is there any ways to make the system run as fast as possible without reading the store so fast that it runs out of memory? Thanks!

@xiangzhi
Copy link
Contributor Author

xiangzhi commented Nov 8, 2021

I tried changing the Delivery policy in the CopyStream function in PsiStore.cs:303 to SynchronousOrThrottle and it still crashes.

@AshleyF
Copy link
Contributor

AshleyF commented Nov 8, 2021

I'm looking into this. Unlimited delivery policies are indeed the likely culprit, with ever-growing queues. Setting to SynchronousOrThrottle in CopyStream, as you did, is a good idea to try. Additionally, could you try setting in Exporter.cs:332: source.PipeTo(connector, DeliveryPolicy.SynchronousOrThrottle);

@xiangzhi
Copy link
Contributor Author

Hey Ashley, I actually just got time to worked on this. You are right, changing source.PipeTo(connector, Delivery.SynchronousOrThrottle) in Exporter.cs:227 worked. I could push a small pull request with this fix but I'm worry there might be a lot of unintended side effects.

@AshleyF
Copy link
Contributor

AshleyF commented Nov 18, 2021

Hey Zhi, glad that works for you. You're right that the effects of throttling and back pressure may not be appropriate for all (most?) scenarios. I believe we'll make this at least configurable though. Thanks much for reporting!

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

No branches or pull requests

2 participants