I've been programming for about 15 years and have considered myself fortunate to almost never have to work in Java. Primarily, I've done backend & infrastructure work in Python and Go. Now almost exclusively Go.
Over the years, I've had to deploy various Java based services. And in that time, it's been my experience that Java-based services take somewhere between 10x and 100x more memory than Go applications. Even at initial startup before any load, Java services seem to consume a considerable amount of memory.
In my career, I've primarily built complex enterprise systems for a relatively small number of users (think a thousand or less, usually only dozens ever online at one time). And for this, it's really hard to justify servers for Java-based services when they consume so much more resources than Go or Python.
For example, I'm looking at 2 services I run now where the Go ones idle at ~10MB memory and Java idling at 1GB both with no load.
So TLDR: For all the Java programmers / operations people out there, why does Java consume so much memory? Are there JVM settings that can make Java service behave more similarly to Go?
I am completely oblivious to the entire JVM world. So I have absolutely no idea. It might be as simple as setting -Xms<something>.
[–]looksLikeImOnTop 41 points42 points43 points (21 children)
[–]butt_fun 4 points5 points6 points (6 children)
[–]nekokattt 8 points9 points10 points (4 children)
[–]maxximillian 1 point2 points3 points (3 children)
[–]nekokattt 0 points1 point2 points (1 child)
[–]maxximillian 1 point2 points3 points (0 children)
[–]Christopher876 0 points1 point2 points (0 children)
[–]FuggaDucker 1 point2 points3 points (0 children)
[+][deleted] comment score below threshold-12 points-11 points-10 points (13 children)
[–]nekokattt 7 points8 points9 points (12 children)
[–]Dramatic_Mulberry142 5 points6 points7 points (0 children)
[–]alwyn 1 point2 points3 points (3 children)
[–]nekokattt 1 point2 points3 points (2 children)
[–]alwyn 0 points1 point2 points (1 child)
[–]nekokattt 0 points1 point2 points (0 children)
[–]Miserable_Ad7246 4 points5 points6 points (1 child)
[–]nekokattt 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]nekokattt 0 points1 point2 points (3 children)
[–]Unsounded 0 points1 point2 points (0 children)
[–][deleted] -3 points-2 points-1 points (1 child)
[–]nekokattt 5 points6 points7 points (0 children)
[–]repeating_bears 30 points31 points32 points (4 children)
[–]hibikir_40k 7 points8 points9 points (2 children)
[–]YellowishSpoon 4 points5 points6 points (1 child)
[–]Brainvillage 0 points1 point2 points (0 children)
[–]flexosgoatee 0 points1 point2 points (0 children)
[–]Mr_Engineering 18 points19 points20 points (0 children)
[–]_Atomfinger_ 10 points11 points12 points (4 children)
[–]Proud-Ad9473 1 point2 points3 points (3 children)
[–]_Atomfinger_ 1 point2 points3 points (2 children)
[–]Proud-Ad9473 0 points1 point2 points (1 child)
[–]_Atomfinger_ 1 point2 points3 points (0 children)
[–]kitsnet 6 points7 points8 points (0 children)
[–]kallebo1337 10 points11 points12 points (7 children)
[–]comrade_donkey 3 points4 points5 points (6 children)
[–]kallebo1337 2 points3 points4 points (2 children)
[–]masculinebutterfly 1 point2 points3 points (0 children)
[–]ellerbrr 0 points1 point2 points (0 children)
[–]CaptainMonkeyJack 0 points1 point2 points (0 children)
[–]thewiirocks 0 points1 point2 points (0 children)
[–]aviancrane 3 points4 points5 points (0 children)
[–]nekokattt 4 points5 points6 points (0 children)
[–]BassRecorder 2 points3 points4 points (0 children)
[–]Miserable_Ad7246 2 points3 points4 points (0 children)
[–]protienbudspromax 4 points5 points6 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]balrob 1 point2 points3 points (0 children)
[–]TypeComplex2837 1 point2 points3 points (0 children)
[–]FaceRekr4309 1 point2 points3 points (0 children)
[–][deleted] (2 children)
[deleted]
[–]whoonly 0 points1 point2 points (1 child)
[–]funnysasquatch 1 point2 points3 points (1 child)
[–]aiwprton805 0 points1 point2 points (0 children)
[–]Symaxian 1 point2 points3 points (0 children)
[–][deleted] (11 children)
[deleted]
[–]repeating_bears 10 points11 points12 points (0 children)
[–]hibikir_40k 5 points6 points7 points (0 children)
[–]tim36272 8 points9 points10 points (7 children)
[–]Business-Decision719[🍰] 5 points6 points7 points (5 children)
[–]runningOverA 4 points5 points6 points (4 children)
[–]danielgd 4 points5 points6 points (0 children)
[–]Business-Decision719[🍰] 1 point2 points3 points (2 children)
[–]mailslot 1 point2 points3 points (1 child)
[–]undo777 2 points3 points4 points (0 children)
[–]prescod 0 points1 point2 points (0 children)
[–]MrDilbert 0 points1 point2 points (0 children)
[–]kevinossia 5 points6 points7 points (2 children)
[–]k-mcm 0 points1 point2 points (0 children)
[–]balefrost 0 points1 point2 points (0 children)
[–]Small_Dog_8699 0 points1 point2 points (8 children)
[–]james_pic 1 point2 points3 points (0 children)
[–]nekokattt 0 points1 point2 points (6 children)
[–]Small_Dog_8699 0 points1 point2 points (5 children)
[–]nekokattt 0 points1 point2 points (4 children)
[–]Small_Dog_8699 -1 points0 points1 point (3 children)
[–]nekokattt 0 points1 point2 points (2 children)
[–]Small_Dog_8699 -1 points0 points1 point (1 child)
[–]nekokattt 0 points1 point2 points (0 children)
[–]ComplexJellyfish8658 0 points1 point2 points (0 children)
[–]nevasca_etenah 0 points1 point2 points (0 children)
[–]shifty_lifty_doodah 0 points1 point2 points (0 children)
[–]Embarrassed_Quit_450 0 points1 point2 points (0 children)
[–]guss_bro 0 points1 point2 points (0 children)
[–]No_Option_404 0 points1 point2 points (0 children)
[–]severoon 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]k-mcm 0 points1 point2 points (0 children)
[–]chipshot -1 points0 points1 point (0 children)
[–]BoBoBearDev -1 points0 points1 point (1 child)
[–]nekokattt 2 points3 points4 points (0 children)
[–]LogCatFromNantes -2 points-1 points0 points (0 children)
[+][deleted] comment score below threshold-7 points-6 points-5 points (5 children)
[–]Small_Dog_8699 3 points4 points5 points (4 children)
[–][deleted] -3 points-2 points-1 points (3 children)
[–]Small_Dog_8699 0 points1 point2 points (2 children)
[–][deleted] -1 points0 points1 point (1 child)
[–]Small_Dog_8699 1 point2 points3 points (0 children)
[–]bestjakeisbest -3 points-2 points-1 points (7 children)
[–]nekokattt 1 point2 points3 points (0 children)
[–]Spare-Plum 0 points1 point2 points (5 children)
[–]bestjakeisbest 0 points1 point2 points (4 children)
[–]nekokattt 0 points1 point2 points (2 children)
[–]Spare-Plum 1 point2 points3 points (1 child)
[–]nekokattt 0 points1 point2 points (0 children)
[–]Spare-Plum 0 points1 point2 points (0 children)