-
Notifications
You must be signed in to change notification settings - Fork 2
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
SPARK 256mb EOM #267
Comments
This seems to be a problem in Deno and V8, see: Related:
I think we should improve Zinnia to give us more visibility into memory usage.
WDYT, @juliangruber? |
Also: Deno.systemMemoryInfo |
How would this be actionable? I can see how in advanced cases the module author would use this, but in our SPARK scenario I don't see why SPARK would want to capture this 🤔
I'm not so sure about that. Zinnia can run many different things (outside of Station), would it be useful to collect information for when we don't know what it's running? Therefore I think it's more useful to collect this information in Station Core (assuming we can get all the info we need from outside the process), which for the current case we can. Or do you think we'll need to measure event loop latency fairly soon? And even if we decide to measure stats from inside Zinnia, I wonder if Zinnia should report it itself, or whether it could expose those stats for Station Core to query and submit.
I think that could work. The quick fix would either be to document that zinnia needs more memory, or to let users control how much memory it has available (if Deno/V8 don't auto-adjust) |
Great discussion!
Let's say we have a suspicion that SPARK has a memory leak or maybe that it is triggering a memory leak in Zinnia. I would like to run SPARK on my computer using I think the only tool I have available right now is to use OS-level tools like macOS Activity Monitor and the Debugging memory leaks would be easier if my Zinnia module could observe how much memory is used at given points in time. It would be even better if there was a way how to create heap snapshots for inspection in Chrome DevTools. And even more awesome would be the option to inspect the Zinnia process by connecting it with Chrome DevTools. DevTools provide functionality for creating memory snapshots and comparing them.
Regarding event loop latency - I think this metric can help us better understand how much CPU of the host machine we are using. It's not needed until there is a problem and we need it to be already in place :) OTOH, if we can measure the CPU consumption of module processes (Zinnia, Bacalhau, etc.) from outside, then I think that's good enough for now. As for submitting the metrics:
This is a fair point. I guess it depends on how frequently we want to report these metrics and what is the overhead of sending them via Station polling as opposed to submitting them to InfluxDB directly. |
@juliangruber To mitigate the impact of OOM, is it perhaps time to improve Station Core to automatically restart Zinnia when it crashes? |
Can you please help me understand why Zinnia exposing this information would be easier than the OS exposing it? 🤔
+100 That would be perfect
Given our small team size my vote is to add it once we require it :P I very much agree that it will be useful eventually.
Fair point, to me
It will need more config variables, right?
If you want to add Influx reporting to zinnia I'm not opposed at all, looks like from a Station perspective it would be a relatively straight forward change to implement. |
With Zinnia API, I can write a Zinnia script that's repeatedly calling the code suspected to leak memory and collect memory usage information over time. An example from denoland/deno#18369 (comment): console.log('Deno version', Deno.version.deno);
let timestamp = new Date();
while (true) {
if (Date.now() >= timestamp.valueOf()) {
const bytes = Deno.memoryUsage().rss;
console.log(timestamp.toISOString(), Math.floor(bytes / (1024 * 1024) * 10) / 10);
timestamp = new Date(timestamp.valueOf() + 1000);
}
const response = await fetch('http://localhost:8080');
await response.text();
} To measure this from the outside, I would need to figure out which |
I opened two follow-up issues: @juliangruber is there anything else we want to change in the near future based on what we learned here, or can we close this issue as resolved? |
Just my 2 cents, but to me writing this script is more work than running
I think that captures it all :) |
The machime had 256MB of ram, I've scale it up to 512MB for now.
@bajtos: Maybe there is a memory leak, maybe the integration with Go is not running GC often enough (or not at all)
This process was running for ~2 days, until it EOMed:
@juliangruber: I wonder if this is an EOM or whether zinnia/deno programs are configured to require more than 256mb of ram
@bajtos: Great point! It is possible that V8 does detect how much memory is available in our setup.
The text was updated successfully, but these errors were encountered: