I have a FastAPI app with Marimo app mounted, as in the docs. No other endpoints at the moment. I’m working with a decent amount of data and the notebook uses roughly 1Gb of memory (per stats in edit mode).
I’ve recently deployed it in the production environment, which for now only has a handful of users, and I’m noticing that the memory usage increases very quickly - 6Gb in only 30 minutes and continues going up, never going down, even after users stop using it. Is there potentially a memory leak with the programmatic deployment? (Idk about “edit or pure “run” mode)
From a glance at the SessionManager code, is it possible that sessions are never cleaned up because kernels are not shutdown? Is there a mechanism that shuts down the kernel in run mode, which would then satisfy the condition to clean orphaned sessions?
Also, any performance tips or gotchas for this type of deployment would be very appreciated - for some reason the app runs much slower in the production environment than locally on my machine or in a dev ec2 instance. If there is anything that you feel could be implemented for improvement, I could have a go at it.