I have build a REST api using Spring boot. The database has 39 tables and the number of Rest controllers are 31. Considering 2000 daily users which hit the API, how do I caclulate the RAM required on AWS ec2(or any xyz cloud provider) for running the API efficiently? As of now I am using their free tier which comes with 1core 1GB ram. But my application keeps on crashing. It stops even when I am not hitting the API. Sometimes logs are getting generated which shows memory issues and maximum times it stops without any server logs.
I have deployed the REST API using java -jar
The first thing to consider is whether your RAM requirements are including running a database or if you're using a database on an external server. AWS does provide ready-to-use database server images. If you're running a database on the same machine as the web service, then the RAM requirements are going to be much higher, since most databases eat a lot of RAM themselves.
As far as telling your RAM requirements for your Spring Boot app, you can simply launch it and use your operating system utilities to find out how much RAM it is using. The "top" command works for Linux and other Unix-style OS's. In Windows, it's the Task Manager that will tell you.
Then realize that the JVM launches with certain pre-set memory allocations and that they may need to be adjusted. To tell how much RAM within the VM is being used, a good Java performance monitoring tool can be used.
I'm going to be a "small government" candidate. I'll be the government. Just me. No one else.