Linked by Thom Holwerda on Fri 14th Sep 2012 02:30 UTC, submitted by MOS6510
Java "As a typical Java developer I never monitored the memory usage of my application apart from following typical best practices like closing the connections, streams etc. Recently we were struck with few issues in our JBoss servers that I had to dig in to the memory management."
Thread beginning with comment 534994
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE: Memory management
by WorknMan on Fri 14th Sep 2012 02:52 UTC in reply to "Memory management"
WorknMan
Member since:
2005-11-13

I was [ts]old they uninvented memory management!


Where I work, based on the amount of permgen/out of memory errors we get on our Java server apps, I think somebody should re-invent memory management ;) Note that I did not write, nor am I in charge of any of these apps. I'm just the poor schmuck who gets paged at 3am when one of these apps blows chunks, and I have to restart the f**king things. Time after time after time.

Our 'architects' have been looking into this for what seems like years, analyzing heap dumps and what not, and they usually just give the apps more permgen space, which fixes the problem ... for awhile, anyway. Then it's back to the same BS. So, I figure either Java absolutely blows ass, or we just need some new architects.

Reply Parent Score: 9

RE[2]: Memory management
by satsujinka on Fri 14th Sep 2012 03:10 in reply to "RE: Memory management"
satsujinka Member since:
2010-03-11

It's probably a combination of both. Though since the issue appears systematic, it's probably time to redraft the system with new criteria.

Reply Parent Score: 3

RE[2]: Memory management
by kwan_e on Fri 14th Sep 2012 06:10 in reply to "RE: Memory management"
kwan_e Member since:
2007-02-18

Are you trying to tell me that Java isn't running on pixie dust* that magically solves the halting problem??!!?!!

* Known as "ground coffee" to developers

Reply Parent Score: 4

RE[2]: Memory management
by Dekonega on Fri 14th Sep 2012 06:43 in reply to "RE: Memory management"
Dekonega Member since:
2009-07-28

Get new architects... Java works when stuff has been correctly designed which is easy to do. Bad thing about Java is that it is also easy to design things which are literally like things out of hell very easily.

Design that works in simple systems doesn't, and will never work if the amount of data to be handled by the system is multiple times more. It needs a complete redesign and it will cost money. Not as much as if it was written in some other language, but it still will cost you guys.

Reply Parent Score: 4

RE[2]: Memory management
by moondevil on Fri 14th Sep 2012 06:49 in reply to "RE: Memory management"
moondevil Member since:
2005-07-08

I will go for new architects.

Most of my consulting projects are done in JVM and .NET languages and I see often what I call "space station architecture" (I adopted the expression from someone else).

Designs done away from the reality, with thousand layers of abstraction, because it is cool.

Most of the performance problems we had to fix in some projects always have to do with architecture decisions.

- Not the right language/OS for the problem at hand;
- Lots of nicely abstracted layers;
- Communication between modules using the wrong type of communication protocols;
- Algorithms that aren't appropriate;
- Multiple remote calls to distributed systems;
- Data structures designed without regard for being GC friendly
- ...

Reply Parent Score: 3

RE[3]: Memory management
by raboof on Fri 14th Sep 2012 17:59 in reply to "RE[2]: Memory management"
raboof Member since:
2005-07-24

"space station architecture" - Designs done away from the reality, with thousand layers of abstraction, because it is cool.

Hmm, I'd expect 'space station architecture' to be a positive classification: if you design something for a space station, you better design it well, because you can't easily go up there and fix it later ;) .

Reply Parent Score: 2

RE[3]: Memory management
by WorknMan on Fri 14th Sep 2012 18:06 in reply to "RE[2]: Memory management"
WorknMan Member since:
2005-11-13

I will go for new architects.


I figured people would say that, because either on the server or desktop, no matter how shitty Java apps run (which seems to be most of the time), it never appears to be Java's fault.

Reply Parent Score: 0

RE[3]: Memory management
by butters on Fri 14th Sep 2012 18:33 in reply to "RE[2]: Memory management"
butters Member since:
2005-07-08

I don't know. Java is a language that invites hotshot "architects" to devise Rube Goldberg machines. Factories that create factories that create classes. Of course they'll want to model it all in UML first, because that's how good code happens. If you bring in new Java architects and give them enough rope, they'll come up with a way to make things more complex than they were before.

Once I was contracted to rewrite a troubled Python application, and after browsing the codebase for an hour, I remarked the poor guy who was maintaining this thing: "This code looks like it was written by some hotshot Java developer". And he said: "How did you know that?"

Reply Parent Score: 4

RE[2]: Memory management
by raboof on Fri 14th Sep 2012 17:39 in reply to "RE: Memory management"
raboof Member since:
2005-07-24

Our 'architects' have been looking into this for what seems like years, analyzing heap dumps and what not, and they usually just give the apps more permgen space, which fixes the problem ... for awhile, anyway.

For permgen space errors, indeed usually increasing it is the way to go. The permanent generation is used for 'static' information (using the word loosely, and apart from some exceptions which are unlikely to be relevant). It is expected to grow a bit after startup, up to the point where everything relevant for your application is loaded and the usage will no longer rise, no matter how much load/data you throw at the system.

If this is an application running inside a servlet container: do you ever restart/upgrade a component/application in the container without restarting the container, too? This is possible, but avoiding memory leaks (even in permgen, as each instance will have its own classloader) is tricky, and it's often acceptable to just restart the entire container.

For heap space errors, yeah, you need a developer to look at those.

You mention 'architects'. In case of memory errors (both permgen and heap), I'd suspect a programming error rather than an architecture error first. I'd suggest having a good developer ('craftsman' seems to be the hip term these days) look at it. He should be able to pinpoint what's the biggest culprit, and from there you can see whether it is possible to fix within the current architecture or that you really need structural changes.

Reply Parent Score: 4

RE[2]: Memory management
by sbenitezb on Mon 17th Sep 2012 04:27 in reply to "RE: Memory management"
sbenitezb Member since:
2005-07-22

Write a script to monitor those apps, so when they blowup they get automatically restarted. No need for you to babysit them at 3am.

Reply Parent Score: 4