#Java app using abnormal amount of ram

25 messages · Page 1 of 1 (latest)

signal cosmos
#

Attached you see the RAM usage graph of my project. I am running a discord bot with a Java Spring Boot application, and on my local device, the app eventually uses <200 mb of RAM, but on railway, the ram usage continues to increase. I found a StackOverflow post that tackles a similar issue, but updating my Dockerfile with the runtime flags did not deliver noticeable changes (see the last deployed commit, compared to the rest). Ideally, I don't have to manually call the GC, although it is an option available to me.

Does anyone have any recommendations for getting my Java app to release unused RAM memory?

shut lightBOT
#

Project ID: 1a73e8f4-a61d-4a67-9bd7-3539b677698b

signal cosmos
gilded ridge
#

that's more so looking like a memory leak to me

signal cosmos
#

If it was, then i'd be able to reproduce that locally, no?

gilded ridge
#

do you build from the dockerfile file and run the resulting image ?

signal cosmos
#

Yes

gilded ridge
#

well it's not like railway is making up metrics

signal cosmos
#

According to stack it's because java isnt by default configured for containers, which is why i asked here if people had knowhow of how i should configure the dockerfile

signal cosmos
# gilded ridge do you build from the dockerfile file and run the resulting image ?

My apologies if I gave you the wrong answer to this question. I mean that Railway is running from the Dockerfile, and my local machine is the bare Java app. Local machine has less ram usage then the deployment on railway.

The attached stackoverflow post claims that java won't unclaim heap space the same way if it's running in a container. There were runtime flags i could add to the dockerfile that'd supposedly fix this, but this did not have the desired effect

gilded ridge
#

what effect did it have, if any

signal cosmos
#

Practically none if it didnt make it worse

hazy ore
#

Are you sure the flags were taken into account when deploying?

signal cosmos
#

How can I verify that?

hazy ore
#

Logs

signal cosmos
#

A quick search doesn't give me any hits for the flags, so i guess they're not being considered

#

I'll play with those when i get back home and see if i can get it working. Probably misusing them

#

I am the most smoothbrained ape on this planet

#

Flags go before the -jar flag 🤦

hazy ore
#

Did it help your heap usage?

signal cosmos
#

Going to redeploy now and see if it helps

signal cosmos
#

I've had her run for a bit and it definitely looks like it helped. RAM usage continues to grow but does so much slower

signal cosmos
#

I'm trying if ShenandoahGC helps more. It looks promising so far

signal cosmos
#

It looks like shenandoahGC has given my app a healthier ram graph. Thank you all for your help!

random flintBOT