« Return to Thread: Memory usage - what are we doing wrong?

Memory usage - what are we doing wrong?

by Marc Palmer Local :: Rate this Message:

Reply to Author | View in Thread

Hello all,

Ho hum I say. It's been a painful deployment today for many reasons.

We have a 2GB Linux server running apache, mysql and a single tomcat  
instance. We have got two Grails apps running in the Tomcat VM... and  
we keep running out of memory and getting blank responses as the VM  
cannot allocate any native threads (native heap - not java heap).  
We're running with:

export CATALINA_OPTS="-XX:MaxPermSize=300M -server -Xmx1000M"

We tried running with more -Xmx but this just blows the heap quicker,  
and googling around shows that less java heap benefits your native  
heap, and we're running out of native threads/stack.

Now our sites are hardly complex:


        +----------------------+-------+-------+
        | Name                 | Files |  LOC  |
        +----------------------+-------+-------+
        | Controllers          |     8 |   346 |
        | Domain Classes       |     7 |   103 |
        | Services             |     3 |   178 |
        | Tag Libraries        |     6 |  1149 |
        | Groovy Helpers       |     3 |   135 |
        | Integration Tests    |     2 |     8 |
        +----------------------+-------+-------+
        | Totals               |    29 |  1919 |
        +----------------------+-------+-------+

        +----------------------+-------+-------+
        | Name                 | Files |  LOC  |
        +----------------------+-------+-------+
        | Controllers          |    25 |  1504 |
        | Domain Classes       |    25 |   438 |
        | Jobs                 |     2 |    24 |
        | Services             |    10 |   565 |
        | Tag Libraries        |     6 |  1015 |
        | Groovy Helpers       |     5 |   131 |
        | Integration Tests    |    20 |   104 |
        +----------------------+-------+-------+
        | Totals               |    93 |  3781 |
        +----------------------+-------+-------+


Now we must be able to get these to coexist with no trouble at all  
within 2GB ... or you'd have to say that there are serious issues  
scaling such trivial apps!

What is interesting is that a lot of the trouble seems to be for some  
minutes after startup. Many pages come back blank and the log shows  
the error:

SEVERE: Caught exception (java.lang.OutOfMemoryError: unable to create  
new native thread) executing org.apache.jk.common.ChannelSocket
$SocketAcceptor@1f546b0, terminating thread

...but later reloads of those pages work, and seem to continue to  
work. It is newly loaded pages that present the problem - they often  
stick and don't respond (== native thread error in stack) but then a  
stop and reload works and there's never a problem on that page again.  
Compiling the GSPs is cpu intensive of course, but i see no reason why  
a modern computer will struggle with close to zero load just with one  
developer browsing around the sites. Nobody else is accessing these  
sites at midnight after lots of downtime (ugh the stories I could tell  
of today...)

Anyway, input and experiences appreciated.

It makes for very unimpressive startups...

Marc


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Memory usage - what are we doing wrong?

LightInTheBox - Buy quality products at wholesale price!