Saturday, September 12, 2015

Useful JVM flags, revisited

This guy Patrick Peschlow (possibly a superhuman, a hero.... most likely a German, only Germans can love so much classifications) did an amazing job at illustrating all (most of) the JVM flags.
He explained it all in such a clear and precise way that I was about to cry for the emotion.

https://blog.codecentric.de/en/2012/07/useful-jvm-flags-part-1-jvm-types-and-compiler-modes/
  • server and -client
  • version and -showversion
  • -Xint, -Xcomp, and -Xmixed


https://blog.codecentric.de/en/2012/07/useful-jvm-flags-part-2-flag-categories-and-jit-compiler-diagnostics/
  • JVM flag categories
  • -XX:+PrintCompilation and -XX:+CITime
  • -XX:+UnlockExperimentalVMOptions
  • -XX:+LogCompilation and -XX:+PrintOptoAssembly


https://blog.codecentric.de/en/2012/07/useful-jvm-flags-part-3-printing-all-xx-flags-and-their-values/
  • -XX:+PrintFlagsFinal and -XX:+PrintFlagsInitial
  • -XX:+PrintCommandLineFlags


https://blog.codecentric.de/en/2012/07/useful-jvm-flags-part-4-heap-tuning/
  • -Xms and -Xmx (or: -XX:InitialHeapSize and -XX:MaxHeapSize)
  • -XX:+HeapDumpOnOutOfMemoryError and -XX:HeapDumpPath
  • -XX:OnOutOfMemoryError
  • -XX:PermSize and -XX:MaxPermSize
  • -XX:InitialCodeCacheSize and -XX:ReservedCodeCacheSize
  • -XX:+UseCodeCacheFlushing


https://blog.codecentric.de/en/2012/08/useful-jvm-flags-part-5-young-generation-garbage-collection/
  • -XX:NewSize and -XX:MaxNewSize
  • -XX:SurvivorRatio
  • -XX:+PrintTenuringDistribution
  • -XX:InitialTenuringThreshold, -XX:MaxTenuringThreshold and -XX:TargetSurvivorRatio
  • -XX:+NeverTenure and -XX:+AlwaysTenure


https://blog.codecentric.de/en/2013/01/useful-jvm-flags-part-6-throughput-collector/
  • Throughput vs. pause times
  • Garbage collection on the HotSpot JVM
  • -XX:+UseSerialGC
  • -XX:+UseParallelGC
  • -XX:+UseParallelOldGC
  • -XX:ParallelGCThreads
  • -XX:-UseAdaptiveSizePolicy
  • -XX:GCTimeRatio
  • -XX:MaxGCPauseMillis


https://blog.codecentric.de/en/2013/10/useful-jvm-flags-part-7-cms-collector/
  • -XX:+UseConcMarkSweepGC
  • -XX:+UseParNewGC
  • -XX:+CMSConcurrentMTEnabled
  • -XX:ConcGCThreads
  • -XX:CMSInitiatingOccupancyFraction
  • -XX+UseCMSInitiatingOccupancyOnly
  • -XX:+CMSClassUnloadingEnabled
  • -XX:+CMSIncrementalMode
  • -XX:+ExplicitGCInvokesConcurrent and -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses
  • -XX:+DisableExplicitGC


https://blog.codecentric.de/en/2014/01/useful-jvm-flags-part-8-gc-logging/
  • -XX:+PrintGC
  • -XX:+PrintGCDetails
  • -XX:+PrintGCTimeStamps and -XX:+PrintGCDateStamps
  • -Xloggc


More References:

http://stas-blogspot.blogspot.de/2011/07/most-complete-list-of-xx-options-for.html

Virtual Machine Garbage Collection Tuning https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/



Friday, September 11, 2015

UCP and RAC

If you configure a Gridlink Datasource with the wrong ServiceName, you might get:

java.sql.SQLException: Pool connect failed : java.lang.ClassCastException: java.lang.Boolean cannot be cast to oracle.ucp.jdbc.oracle.OracleConnectionAffinityContext

This is possibly one of the weirdest exceptions I have ever seen...spooky and unreal...
It turns out that the root cause could also be that tablespace is full, or other DB-related issues.... but it's NOT a WLS or Application issue (apart from being a useless error message...)

If you wonder what the "ucp" means, it's a RAC-specific implementation of the more traditional connection pool : https://docs.oracle.com/cd/E11882_01/java.112/e12265/intro.htm#BABDIDGD

The way I understand it is that a UCP is a RAC-specific Connection Pool service running UNDER the WebLogic connection pool, and handling RAC-specific features like seamless recovery from node failures.

PS the whole stacktrace is:

Caused By: java.sql.SQLException: java.lang.ClassCastException: java.lang.Boolean cannot be cast to oracle.ucp.jdbc.oracle.OracleConnectionAffinityContext
        at weblogic.jdbc.common.internal.JDBCUtil.wrapAndThrowResourceException(JDBCUtil.java:278)
        at weblogic.jdbc.common.internal.RmiDataSource.getPoolConnection(RmiDataSource.java:503)
        at weblogic.jdbc.common.internal.RmiDataSource.getConnectionInternal(RmiDataSource.java:594)
        at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:545)
        at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:538)
        Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassCastException: java.lang.Boolean cannot be cast to oracle.ucp.jdbc.oracle.OracleConnectionAffinityContext
        at oracle.ucp.jdbc.oracle.RACManagerImpl.selectConnectionPerRCLBAndAffinity(RACManagerImpl.java:2126)
        at weblogic.jdbc.common.rac.internal.UCPRACModuleImpl.getConnection(UCPRACModuleImpl.java:269)
        at weblogic.jdbc.common.internal.HAConnectionPool.reserve(HAConnectionPool.java:264)
        at weblogic.jdbc.common.internal.ConnectionPoolManager.reserve(ConnectionPoolManager.java:137)
        at weblogic.jdbc.common.internal.RmiDataSource.getPoolConnection(RmiDataSource.java:501)
        Truncated. see log file for complete stacktrace




Tuesday, September 8, 2015

The simplest possible Windows FTP server

http://www.sentex.net/~mwandel/ftpdmin/ ftpdmin .... if all you need is to have a colleague send you a big file which doesn't fit in an email, this utility is for you.... just remember to start it with a root dir, because you don't want to give access to your whole hard drive.... you can operate on it using the windows built-in fto client, and just hit ENTER when asked for username and password...