Get help from the marimo community

Home
Members
marcodlk
m
marcodlk
Offline, last seen 6 days ago
Joined January 15, 2025
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.
2 comments
A
I’m developing a Marino app that is mounted in FastAPI. One of the requirements for this project is that the app needs to have different banners depending on the environment it is deployed. Currently, I’m doing something like:

Plain Text
import marimo as mo
import os 

ENV_ID = os.getenv(“ENV_ID”)

app = marimo.App(html_head_file=f"head_{ENV_ID}.html")


It works but the issue is that when in notebook editor mode, on save, marimo will remove the “import os” and ENV_ID set line. Not a blocker, just a bit cumbersome to put it back every time, but I’m wondering if there could be a formal way to support dynamic app configuration such as this.

Perhaps an app factory approach could work? Could specify path to the factory callable in .marimo.toml.

I think dynamic configuration would be really powerful for those of us using programmatic Marimo deployments.

I’m currently on marimo 0.10.14
6 comments
M
m