Apply metabase ram limit for JVM or docker container?

Using docker
t3a.medium ec2 (4 gb ram, 2 cores)
Nginx and Postgres (metabase application db) on same server
Around 2.5 gb available for metabase
In docker run command I am using -e "JAVA_OPTS=-Xmx2g".
When I do docker stats, I see available memory for metabase container as ~3.75gb (which is host ram i.e. 4 gb)

And while syncing at one point, I saw ram use by metabase as 2.45gb / 3.75 gb

So clearly env JAVA_OPTS is not sufficient to rely on as container ram is exceeding this value
So should I use another parameter in docker run of --memory=2.5g along with -e "JAVA_OPTS=-Xmx2g", as it possible that JVM might be limiting itself within 2 gb but other things associated might be using the ram above 2gb of JVM ?

Thanks in advance

Edit: I am connecting metabase to data source (not application db) Postgres having total data of 73 gb

Also I see sometimes cpu usage of docker metabase container as 194% (total 200% as 2 cores)
so should I limit metabase container to 100 or 150% (i.e. 1 or 1.5 cores) ?

If you run just Metabase in that machine, leave it to use all the resources

Like I said in description Nginx and Postgres (metabase application db) on same server

So Nginx, Postgres application db and Metabase are there on this 4gb 2 cores t3a.medium ec2.

So do you still recommend to leave it to use all resources ?

Please update, it will of great help

Just tweak the ram for each service, leave the most amount of ram for Postgres and Metabase

1 Like

It is often crashing while scanning db.
Does this indicates more ram is needed ?
I gave 2 gb to jvm
@Luiggi

Yes, it needs more ram or to scan less data

1 Like