2012-02-06 4 views
7

Uso il profilo web Glassfish 3.1.1 in ambiente di produzione e consumo eccessivo di CPU. Ecco le impostazioni del server: Windows Server 2008 R2 a 64 bit, Intel Xeon 8core a 3,2 GHz, RAM da 8 GB. Sto usando JDK 1.7u2 a 64 bit. impostazioni Glassfish JVM:Glassfish - alta CPU usge

<jvm-options>-XX:+UseCompressedOops</jvm-options> 
<jvm-options>-Xmn1g</jvm-options> 
<jvm-options>-Xss128k</jvm-options> 
<jvm-options>-XX:+UseParallelOldGC</jvm-options> 
<jvm-options>-XX:ParallelGCThreads=4</jvm-options> 
<jvm-options>-Xmx3g</jvm-options> 
<jvm-options>-XX:+DisableExplicitGC</jvm-options> 
<jvm-options>-d64</jvm-options> 
<jvm-options>-XX:PermSize=256m</jvm-options> 
<jvm-options>-Xms3g</jvm-options> 
<jvm-options>-XX:MaxPermSize=256m</jvm-options> 
<jvm-options>-XX:+AggressiveHeap</jvm-options> 

Ho anche sintonizzare alcune opzioni in base alle http://jfarcand.wordpress.com/2009/11/27/putting-glassfish-v3-in-production-essential-surviving-guide/ corsa per qualche ora o per 1 giorno Glassfish utilizzare il 15% al ​​40% della CPU, someties il 90% e l'applicazione dose non rispondere.

[#|2012-02-03T10:30:46.837+0100|WARNING|glassfish3.1.1|com.sun.grizzly.config.GrizzlyServiceListener|_ThreadID=43;_ThreadName=Thread-2;|GRIZZLY0023: Interrupting idle Thread: http-thread-pool-80(32).|#] 

[#|2012-02-03T10:30:55.074+0100|WARNING|glassfish3.1.1|com.sun.grizzly.config.GrizzlyServiceListener|_ThreadID=41;_ThreadName=Thread-2;|GRIZZLY0023: Interrupting idle Thread: http-thread-pool-80(41).|#] 

[#|2012-02-03T10:30:56.665+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;|java.nio.channels.ClosedChannelException 
    at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(SocketChannelImpl.java:249) 
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:440) 
    at com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:108) 
    at com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:76) 
    at com.sun.grizzly.http.SocketChannelOutputBuffer.flushChannel(SocketChannelOutputBuffer.java:326) 
    at com.sun.grizzly.http.SocketChannelOutputBuffer.flushBuffer(SocketChannelOutputBuffer.java:398) 
    at com.sun.grizzly.http.SocketChannelOutputBuffer.realWriteBytes(SocketChannelOutputBuffer.java:282) 
    at com.sun.grizzly.tcp.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:898) 
    at com.sun.grizzly.tcp.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:167) 
    at com.sun.grizzly.tcp.http11.filters.GzipOutputFilter$FakeOutputStream.write(GzipOutputFilter.java:223) 
    at java.util.zip.GZIPOutputStream.finish(GZIPOutputStream.java:169) 
    at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:238) 
    at com.sun.grizzly.tcp.http11.filters.GzipOutputFilter.recycle(GzipOutputFilter.java:186) 
    at com.sun.grizzly.http.SocketChannelOutputBuffer.recycle(SocketChannelOutputBuffer.java:417) 
    at com.sun.grizzly.http.ProcessorTask.finishResponse(ProcessorTask.java:817) 
    at com.sun.grizzly.http.ProcessorTask.postResponse(ProcessorTask.java:750) 
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:726) 
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019) 
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) 
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) 
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) 
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) 
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) 
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) 
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) 
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71) 
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) 
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) 
    at java.lang.Thread.run(Thread.java:722) 
|#] 

[#|2012-02-03T10:30:56.665+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(SocketChannelImpl.java:249)|#] 

[#|2012-02-03T10:30:56.665+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:440)|#] 

[#|2012-02-03T10:30:56.665+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:108)|#] 

[#|2012-02-03T10:30:56.665+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:76)|#] 

[#|2012-02-03T10:30:56.665+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.http.SocketChannelOutputBuffer.flushChannel(SocketChannelOutputBuffer.java:326)|#] 

[#|2012-02-03T10:30:56.665+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.http.SocketChannelOutputBuffer.flushBuffer(SocketChannelOutputBuffer.java:398)|#] 

[#|2012-02-03T10:30:56.665+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.http.SocketChannelOutputBuffer.realWriteBytes(SocketChannelOutputBuffer.java:282)|#] 

[#|2012-02-03T10:30:56.665+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.tcp.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:898)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.tcp.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:167)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.tcp.http11.filters.GzipOutputFilter$FakeOutputStream.write(GzipOutputFilter.java:223)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at java.util.zip.GZIPOutputStream.finish(GZIPOutputStream.java:169)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:238)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.tcp.http11.filters.GzipOutputFilter.recycle(GzipOutputFilter.java:186)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.http.SocketChannelOutputBuffer.recycle(SocketChannelOutputBuffer.java:417)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.http.ProcessorTask.finishResponse(ProcessorTask.java:817)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.http.ProcessorTask.postResponse(ProcessorTask.java:750)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:726)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.ContextTask.run(ContextTask.java:71)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)|#] 

[#|2012-02-03T10:30:56.681+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=138;_ThreadName=Thread-2;| at java.lang.Thread.run(Thread.java:722)|#] 

[#|2012-02-03T10:31:00.440+0100|WARNING|glassfish3.1.1|com.sun.grizzly.config.GrizzlyServiceListener|_ThreadID=40;_ThreadName=Thread-2;|GRIZZLY0023: Interrupting idle Thread: http-thread-pool-80(38).|#] 

[#|2012-02-03T10:33:49.170+0100|WARNING|glassfish3.1.1|com.sun.grizzly.config.GrizzlyServiceListener|_ThreadID=40;_ThreadName=Thread-2;|GRIZZLY0023: Interrupting idle Thread: http-thread-pool-80(11).|#] 

[#|2012-02-03T10:33:57.235+0100|WARNING|glassfish3.1.1|com.sun.grizzly.config.GrizzlyServiceListener|_ThreadID=43;_ThreadName=Thread-2;|GRIZZLY0023: Interrupting idle Thread: http-thread-pool-80(16).|#] 

Edit: ho risolto il problema, c'è bug in Glassfish compressione gzip, così ho spento. http://www.java.net/forum/topic/glassfish/glassfish/glassfish-301-gzip-problem-threads-apparently-spinning-100-cpu-use

Invece vorrei usare questo: http://www.servletsuite.com/servlets/gzipflt.htm per comprimere il contenuto.

risposta

0

Abbiamo avuto un problema simile, anche se non abbiamo utilizzato GZIP. Dopo un po '(e sotto carico elevato), nei registri avrebbero il pieno di

GRIZZLY0023: Interrupting idle Thread: http-thread-pool-28080(34)

Siamo riusciti a risolvere questo per Glassfish 3.1.1 aggiornando Grizzly a una versione che si trova in Glassfish 3.1.2.2. Per saperne di più su http://thumbtribe-it.blogspot.com/2012/10/grizzly0023.html

+0

Sì, sto anche ricevendo il comportamento di divorare la CPU sulla mia macchina dev. La cosa divertente è che l'istanza GF NON è sotto carico. In effetti, posso lasciarlo in esecuzione con NESSUNA applicazione distribuita, e lo farà dopo un certo periodo di tempo (mi dispiace, non ho ancora provato a farlo ora). Questo link potrebbe essere rilevante per alcuni: http://gregorbowie.wordpress.com/2012/05/03/java-glassfish-v3-high-cpu-and-memory-usage-locked-threads-death/ – demaniak

1

Questo è apparentemente un bug in GlassFish 3.1.1 e 3.1.2. Lo JIRA issue for it contiene patch che potrebbero essere d'aiuto.

0

Questo può essere causato da un ciclo infinito in codice Java a cui fa riferimento un'espressione in una vista. Take a tread dump del server delle applicazioni quando è in esecuzione e ottiene questo problema e cerca i thread problematici come il tuo http-thread-pool-80(32) e http-thread-pool-80(41) - se il tuo server delle applicazioni passa tutto il tempo su una sezione del tuo codice applicazione, potrebbe essere un ciclo infinito (o qualcos'altro che fa sì che il codice venga eseguito più spesso di quanto dovrebbe).