Keep jRuby.jar in memory - java

I'm wrote simple jRuby scriptlets support in my tomcat 7 java application. If I invoke page, that using jRuby first time, it loads about 3-7 seconds. Next time it loads faster. But, after some time jRuby unloading from memory, and after request I'm again wait 3-7 seconds.
Does exists any methods to always keep jRuby in memory withouth unloading?
PS. Current tomcat run options:
-Xmx2048M -Xms2048M -XX:ParallelGCThreads=8 -Xincgc -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:+AggressiveOpts -XX:+CMSParallelRemarkEnabled -XX:+DisableExplicitGC -XX:MaxGCPauseMillis=500 -XX:SurvivorRatio=16 -XX:TargetSurvivorRatio=90 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -Xnoclassgc -XX:UseSSE=3 -XX:PermSize=512m -XX:LargePageSizeInBytes=4m
I'm using Oracle java 6u26.

Related

IntelliJ IDEA is too slow during run or debug [duplicate]

How can I make IDEA to run faster in Ubuntu? I am running it in a i7 thinkpad with 6 gigs of RAM.
Disable all unused plugins for example Struts 2, Subversion Integration, UI Designer if you don't have deal with them.
Also increase memory heap, for that I suggest you check following links:
Tuning IntelliJ IDEA
JetBrains' new intelliJ IDEA 13 slow?
help -> edit custom vm options -> change everything to:
--server
-Xms1024m
-Xmx1024m
-Xmn256m
-XX:MetaspaceSize=256m
-XX:ReservedCodeCacheSize=2g
-XX:SoftRefLRUPolicyMSPerMB=50
-Xverify:none
-XX:PermSize=128m
-XX:+UseCompressedOops
-XX:+UseG1GC
-XX:+UseNUMA
-XX:MaxMetaspaceSize=1024m
-XX:CICompilerCount=2
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-XX:CICompilerCount=2
-ea
-Dsun.io.useCanonPrefixCache=false
-Dkotlinx.coroutines.debug=off
-Djdk.module.illegalAccess.silent=true
-Dide.no.platform.update=true
-Djdk.attach.allowAttachSelf=true
-Dsun.io.useCanonCaches=false
-Djdk.http.auth.tunneling.disabledSchemes=""
-Djdk.attach.allowAttachSelf=true
-Djdk.module.illegalAccess.silent=true
-Dkotlinx.coroutines.debug=off
-XX:ErrorFile=$USER_HOME/java_error_in_idea_%p.log
-XX:HeapDumpPath=$USER_HOME/java_error_in_idea.hprof

JVM 11 flag PrintHeapAtGC not recognized by Amazon's Corretto JVM 11

Ran into this, the weird thing is, I can't find any pages about it. Searching for "PrintHeapAtGC not recognized" on google results in nothing helpful. In fact, it results in thread talking about how people are using it in JVM 11 with no problem.
I've printed the flags I use one per line, perhaps it's because of some combination I don't know is even a combination?
How do I even check that?
Can someone have a look at this and tell me what's wrong?
-XX:+ExitOnOutOfMemoryError
-XX:NewRatio=3
-XX:SurvivorRatio=4
-XX:TargetSurvivorRatio=90
-XX:MaxTenuringThreshold=8
-XX:+UseParallelGC
-XX:ParallelGCThreads=4
-XX:+CMSScavengeBeforeRemark
-XX:PretenureSizeThreshold=64m
-XX:+UseCMSInitiatingOccupancyOnly
-XX:CMSInitiatingOccupancyFraction=50
-XX:CMSMaxAbortablePrecleanTime=6000
-XX:+CMSParallelRemarkEnabled
-XX:+ParallelRefProcEnabled
-XX:-OmitStackTraceInFastThrow -verbose:gc
-XX:+PrintHeapAtGC
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintGCTimeStamps
-XX:+PrintTenuringDistribution
-XX:+PrintGCApplicationStoppedTime -Xloggc:/tmp/gc.log
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=9
-XX:GCLogFileSize=20M
-XX:+PrintFlagsFinal
-XX:+PrintFlagsWithComments -version
There is no more -XX:+PrintHeapAtGC and some other Print options since JDK 9.
The -XX logging flags were replaced with Unified JVM Logging mechanism.
New equivalent for PrintHeapAtGC is -Xlog:gc+heap=debug

SQL Server TDSPacket consumes too much heap space

Our web application keep on crashing with error message as "GC overhead limit exceeded" after 30 minutes from start time.
I generated heap dump at that moment and loaded into eclipse MAT. It mentioned that TDSPacket as the problem suspect. As this is the library we are using to connect to SQL server, I am unable to trouble shoot from here.
Any suggestion please. Here are the JAVA_OPTIONS used.
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=D:\Apps\Logs\tomcat\memory -Xms2g -Xmx2g -XX:+UseG1GC -XX:+DisableExplicitGC -Xloggc:gc.log -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintGC -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=50 -XX:GCLogFileSize=2M exit -Xms2048m -Xmx2048m

why the java process consume much higher memory than jcmd output?

In my java program I use java nio to communicate with another process, and my code doesn't allocate any direct ByteBuffer.
My code use an open source lib to communicate with another process with unix domain socket: https://github.com/jnr/jnr-unixsocket
and I use some jvm paramter to limit the memory size:
-Djdk.nio.maxCachedBufferSize=262144 -Xms80m -Xmx80m -Xmn40m -Xss256k -XX:NativeMemoryTracking=detail -XX:+UnlockDiagnosticVMOptions -XX:+PrintNMTStatistics -XX:MetaspaceSize=40m -XX:MaxMetaspaceSize=40m -XX:MaxDirectMemorySize=10m -XX:SurvivorRatio=2 -XX:TargetSurvivorRatio=90 -XX:+UseConcMarkSweepGC -XX:ParallelGCThreads=8 -XX:MaxTenuringThreshold=15 -XX:+PrintTenuringDistribution -XX:+UseParNewGC -XX:CMSFullGCsBeforeCompaction=5 -XX:+UseCMSCompactAtFullCollection -XX:+CMSPermGenSweepingEnabled -XX:CMSInitiatingOccupancyFraction=50 -XX:+CMSClassUnloadingEnabled -XX:+DisableExplicitGC -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps
how after several hours, the size of java process grows to more than 400MB
and I use jcmd to check the memory of the process
the total is about 200MB, so why the physical memory consumed by the java prcocess grow to a size much bigger than jcmd output?
I use java 8.

How to speed up IntelliJ on Mac OS X 10.9

I'm using Mac OSX 10.9 and Intellij Idea 13 on a decked out machine (7i processor, 16GB RAM, 64 bit, etc.). I have things working well; however, it seems to me that Intellij is running pretty slow (approx. 5 mins to boot up, almost a full 2 minutes to compile a system out print line class, etc.). As a frame of reference I have looked through numerous posts and have landed on the configurations below. My question is this. Does anyone else use a similar set up and have it running quicker? If so, what modifications have you made to your environment to speed things up. Thanks in advance for any help.
Java Version:
Switched from jdk1.6 to jdk1.7
idea.vmoptions:
-ea
-server
-Xms1g
-Xmx1g
-Xss16m
-XX:PermSize=512m
-XX:MaxPermSize=512m
-XX:+DoEscapeAnalysis
-XX:+UseCompressedOops
-XX:+UnlockExperimentalVMOptions
-XX:+UseConcMarkSweepGC
-XX:LargePageSizeInBytes=256m
-XX:ReservedCodeCacheSize=96m
-XX:+UseCodeCacheFlushing
-XX:+UseCompressedOops
-XX:ParallelGCThreads=8
-XX:+UseParNewGC
-XX:+UseConcMarkSweepGC
-XX:+DisableExplicitGC
-XX:+ExplicitGCInvokesConcurrent
-XX:+PrintGCDetails
-XX:+PrintFlagsFinal
-XX:+AggressiveOpts
-XX:+HeapDumpOnOutOfMemoryError
-XX:+CMSClassUnloadingEnabled
-XX:+CMSPermGenSweepingEnabled
-XX:CMSInitiatingOccupancyFraction=60
-XX:+CMSClassUnloadingEnabled
-XX:+CMSParallelRemarkEnabled
-XX:+UseAdaptiveGCBoundary
-XX:+UseSplitVerifier
-XX:CompileThreshold=10000
-XX:+UseCompressedStrings
-XX:+OptimizeStringConcat
-XX:+UseStringCache
-XX:+UseFastAccessorMethods
-XX:+UnlockDiagnosticVMOptions
info.plist (modification):
<key>LSArchitecturePriority</key>
<array>
<string>x86_64</string>
</array>
<key>JVMVersion</key>
<string>1.7*</string>
I strongly suggest you not to use all these VM options (especially those controlling garbage collector) unless you actually measure they will improve performance.
Please report reproducable performance problems as described here https://intellij-support.jetbrains.com/entries/29983118-Reporting-performance-problems
Here's the scoop. There is a lot of stuff out there about changing the heap size, garbage collectors and what not. It may not be the root cause of your problem. Be sure to understand what you are setting in your vmoptions file as several suggestions aren't really supported any longer. I worked with the folks at IntelliJ going back and forth with log files and what not and it boils down to this. Check your anti virus. After adjusting my anti-virus, the following settings have IntelliJ screaming. Please note that this was the cause to my individual problem; so be sure to check your log files because that is where I started to find answers.
JDK 1.6
.vmoptions is running in the /Application/IntelliJ13/bin:
-Xms128m
-Xmx750m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=96m
-XX:+UseCompressedOops
*notice that you don't need to allocate huge amounts of system resources. If you set up your system correctly it isn't needed.
Idea.plist:
<key>LSArchitecturePriority</key>
<array>
<string>x86_64</string>
<string>i386</string>
</array>
<key>JVMVersion</key>
<string>1.6*</string>
I know it is simple but it works.

Categories