a year ago
How can I lower the ram consumption of my app, it consumes 1GB of ram without having much use
5 Replies
a year ago
What kind of app is this?
Typically, make sure you're not running a development server, that the environment is set to production and you've compiled down to the language you want to run ( for example, make sure you're not running typescript in production )
Of course the best way to have better memory usage is to simply optimize your code ( or use Rust )
a year ago
What kind of app is this?
Typically, make sure you're not running a development server, that the environment is set to production and you've compiled down to the language you want to run ( for example, make sure you're not running typescript in production )
Of course the best way to have better memory usage is to simply optimize your code ( or use Rust )
It is an application that is developed in spring boot, it is only consumed from a mobile front and has little use, which is why so much ram consumption seems very strange to me
a year ago
That does seem strange, perhaps you have a java package that's using an unreasonable amount of memory?
You'd need to investigate this in your code though, this is very unlikely to be a Railway specific issue
a year ago
run the Jar and on Windows it consumes 254 ram, it is very strange.
a year ago
Java tends to claim RAM memory it doesn't need when there is a lot of ram available. There's a few things you can do to lower your ram usage on railway specifically:
pick a garbage collector. Java tends to change its GC strategies on the environment it runs in. I recommend ShenandoahGC, if it is available in your JDK/JRE.
set an upper limit for heap size. Java tends to prefer not adjusting it's heap size too much, and if there's a bunch of free heap size, java will prefer not to do garbage collection. By limiting heap size, you will force java to collect garbage more often, which means your code can do the same stuff with less RAM usage.
Status changed to Solved railway[bot] • over 1 year ago