So, I’ve been using AWS EC2 for awhile to host my app. I’ve been able to get away with using 2 instances as t2.mediums for awhile. However as I get more traffic it seems like the 4GB memory isn’t enough. The instances barely break a sweat on CPU usage. I was thinking of bumping to m4.large for double the memory.
I was wondering if you had any tips/advice on what instance types or any other info really for tomcat apps!
R4 has better networking and higher ram:CPU ratios so you may be able to use smaller instances. May not help at the smaller end of the instance scale though.
Why not t2.large? If you’re not hitting CPU or IO constraints, t2 will give you the most memory for the $ until you get to 16G, then r4 becomes most cost-effective.
I have alarms in place which flag over 80% memory, and looking at the CPU and memory graphs in CloudWatch ~90% memory utilization corresponds to ~5.5% CPU utilization.
80% memory isn’t inherently bad. If you’re deliberately caching data in process, that would be expected. If you’re doing file I/O you’ll use block cache. Many, many scenarios where it’s perfectly normal.
Memory isn’t written to CloudWatch without an extra agent. What are you using to capture that metric and what is it measuring specifically?
I was meaning as a java opt environment variable similar to xms and xmx memory arguments. Totally cool that’s you don’t have a resource I’ll just google one.
Ok, well can’t help much further w/o GC logs but what you describe isn’t inherently wrong. If you’re setting min:max to the same, it’s not uncommon for the JVM to consume the memory you allocate. If the metric is reporting above that, you may have off heap caching or FS caching kicking in. Impossible to know without you posting more detail. At the end of the day, still not seeing anything to indicate that you actually have memory pressure. Everything you describe is typical for a regular cadence of requests to an HTTP server and I still don’t see a reason to change families and sizes.
Awesome, thanks for all the help and tips. I’m putting GC logs in place now and I’ll monitor them to see what’s going on. Any particular thing you suggest I watch out for?
No problemo. Frequency and duration of collection as well as memory reclaimed during collections would be the starting point. How to do that depends on the collector you’re using.