Sunday, April 12, 2020

Comparing performance between Java and GraalVM using HelloWorld

// HelloWorld.java

class HelloWorld {
  public static void main(String []args) {
    System.out.println("Hello World!");
  }
}
Compile using Java
[oracle@ol8 graalvm]$ javac HelloWorld.java
Compile the GraalVM native-image
[oracle@ol8 graalvm]$ native-image HelloWorld
Build on Server(pid: 8165, port: 41485)
[helloworld:8165] classlist: 443.81 ms, 1.00 GB
[helloworld:8165] (cap): 3,624.20 ms, 1.47 GB
[helloworld:8165] setup: 6,859.23 ms, 1.47 GB
[helloworld:8165] (typeflow): 15,129.44 ms, 2.51 GB
[helloworld:8165] (objects): 13,985.98 ms, 2.51 GB
[helloworld:8165] (features): 474.70 ms, 2.51 GB
[helloworld:8165] analysis: 30,229.96 ms, 2.51 GB
[helloworld:8165] (clinit): 825.54 ms, 2.51 GB
[helloworld:8165] universe: 1,554.51 ms, 2.51 GB
[helloworld:8165] (parse): 4,234.29 ms, 2.51 GB
[helloworld:8165] (inline): 3,430.47 ms, 2.65 GB
[helloworld:8165] (compile): 27,552.36 ms, 2.65 GB
[helloworld:8165] compile: 36,017.72 ms, 2.65 GB
[helloworld:8165] image: 1,535.45 ms, 2.65 GB
[helloworld:8165] write: 362.66 ms, 2.65 GB
[helloworld:8165] [total]: 77,848.27 ms, 2.65 GB
Check the file type
[oracle@ol8 graalvm]$ file helloworld
helloworld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=a61b6ddb0c2a51fc2e9fdc748a000ec65b5e5c3d, with debug_info, not stripped, too many notes (256)
Check the file type
[oracle@ol8 graalvm]$ ls -ltrh
total 6.5M
drwxr-xr-x. 10 oracle oinstall 232 Apr 12 21:04 graalvm-ce-java11-20.0.0
-rw-r--r--. 1 oracle oinstall 104 Apr 12 21:10 HelloWorld.java
-rw-r--r--. 1 oracle oinstall 426 Apr 12 21:10 HelloWorld.class
-rwxr-xr-x. 1 oracle oinstall 6.5M Apr 12 21:12 helloworld
Compare single execution time
[oracle@ol8 graalvm]$ time java HelloWorld
Hello World!

real 0m0.167s
user 0m0.189s
sys 0m0.047s

[oracle@ol8 graalvm]$ time ./helloworld
Hello World!

real 0m0.010s
user 0m0.002s
sys 0m0.007s
Compare multiple execution time (using 100 as example)
[oracle@ol8 graalvm]$ cat java.sh
for i in {1..100}
do
  java HelloWorld >/dev/null
done

[oracle@ol8 graalvm]$ time ./java.sh
real 0m15.550s
user 0m17.017s
sys 0m4.643s

[oracle@ol8 graalvm]$ cat graalvm.sh
for i in {1..100}
do
  ./helloworld >/dev/null
done

[oracle@ol8 graalvm]$ time ./graalvm.sh
real 0m0.841s
user 0m0.264s
sys 0m0.538s

Thursday, April 9, 2020

WebLogic script (wlst or stopWebLogic.sh) failure due after enabling ssl for admin port

Symptom:


This Exception occurred at Thu Apr 09 19:54:49 SGT 2020.
javax.naming.CommunicationException: Failed to initialize JNDI context, tried 2 time or times totally, the interval of each time is 0ms.
t3s://10.0.2.15:9002: Destination 10.0.2.15, 9002 unreachable.; nested exception is:
        javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; No available router to destination.; nested exception is:
        java.rmi.ConnectException: No available router to destination. [Root exception is java.net.ConnectException: t3s://10.0.2.15:9002: Destination 10.0.2.15, 9002 unreachable.; nested exception is:
        javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; No available router to destination.; nested exception is:
        java.rmi.ConnectException: No available router to destination.]
Traceback (most recent call last):
  File "/u01/wls14/user_projects/domains/DEV_DOMAIN/shutdown-AdminServer.py", line 3, in
    connect(  url='t3s://10.0.2.15:9002', adminServerName='AdminServer')
  File "", line 19, in connect
  File "", line 548, in raiseWLSTException
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at java.base/java.lang.Class.newInstance(Class.java:584)
        at org.python.core.PyObject.proxyInit(PyObject.java:200)
        at org.python.core.Deriveds.dispatch__init__(Deriveds.java:24)
        at org.python.core.PyObjectDerived.dispatch__init__(PyObjectDerived.java:1112)
        at org.python.core.PyType.type___call__(PyType.java:1822)
        at org.python.core.PyType.__call__(PyType.java:1805)
        at org.python.core.PyObject.__call__(PyObject.java:480)
        at org.python.core.PyObject.__call__(PyObject.java:484)
        at org.python.pycode._pyx37.raiseWLSTException$28(:548)
        at org.python.pycode._pyx37.call_function()
        at org.python.core.PyTableCode.call(PyTableCode.java:171)
        at org.python.core.PyBaseCode.call(PyBaseCode.java:139)
        at org.python.core.PyFunction.__call__(PyFunction.java:413)
        at org.python.pycode._pyx8.connect$1(:22)
        at org.python.pycode._pyx8.call_function()
        at org.python.core.PyTableCode.call(PyTableCode.java:171)
        at org.python.core.PyBaseCode.call(PyBaseCode.java:308)
        at org.python.core.PyFunction.function___call__(PyFunction.java:471)
        at org.python.core.PyFunction.__call__(PyFunction.java:466)
        at org.python.pycode._pyx32.f$0(/u01/wls14/user_projects/domains/DEV_DOMAIN/shutdown-AdminServer.py:5)
        at org.python.pycode._pyx32.call_function(/u01/wls14/user_projects/domains/DEV_DOMAIN/shutdown-AdminServer.py)
        at org.python.core.PyTableCode.call(PyTableCode.java:171)
        at org.python.core.PyCode.call(PyCode.java:18)
        at org.python.core.Py.runCode(Py.java:1614)
        at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:296)
        at weblogic.management.scripting.WLST.main(WLST.java:192)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at weblogic.WLST.main(WLST.java:47)


How to fix: add highlighted lines to necessary scripts.

[oracle@ol8 /u01/wls14/user_projects/domains/DEV_DOMAIN/bin]$ diff  setDomainEnv.sh.bak setDomainEnv.sh
533c533
< JAVA_OPTIONS="${JAVA_OPTIONS}"
---
> JAVA_OPTIONS="${JAVA_OPTIONS}  -Dweblogic.security.TrustKeyStore=DemoTrust -Dweblogic.security.SSL.ignoreHostnameVerification=true "

WSLT:
$MW_HOME/oracle_common/common/bin/setWlstEnv_internal.sh

JVM_ARGS="${WLST_PROPERTIES} ${JVM_D64} ${UTILS_MEM_ARGS} ${CONFIG_JVM_ARGS} -Dweblogic.security.TrustKeyStore=DemoTrust -Dweblogic.security.SSL.ignoreHostnameVerification=true "


Tuesday, April 7, 2020

WebLogic 14c silent installation

Installation

oracle@ol8 stage]$ java -jar fmw_14.1.1.0.0_wls.jar -silent ORACLE_BASE=/u01 ORACLE_HOME=/u01/wls14 JAVA_HOME=/usr/java/jdk-11.0.6
Launcher log file is /tmp/OraInstall2020-04-07_12-31-12PM/launcher2020-04-07_12-31-12PM.log.
Extracting the installer . . . . . . Done
Checking if CPU speed is above 300 MHz.   Actual 2112.000 MHz    Passed
Checking swap space: must be greater than 512 MB.   Actual 4165 MB    Passed
Checking temp space: must be greater than 300 MB.   Actual 29819 MB    Passed
Preparing to launch the Oracle Universal Installer from /tmp/OraInstall2020-04-07_12-31-12PM
oraInstFile: /etc/oraInst.loc


You are starting your first installation on this host or you do not have sufficient permission to access current inventory. As part of this install, you need to specify a directory for installer files. This is called the "inventory directory". Within the inventory directory, the installer automatically sets up subdirectories for each product to contain inventory data and will consume typically 150 Kilobytes per product.
It is recommended that this file (oraInst.loc) be created in /etc directory. You need root privileges to do so. You can exit the installer and run the script located in /tmp/createCentralInventory1586233877409.sh to set up the central inventory location.

If you choose not to create the central inventory location pointer file ( /etc/oraInst.loc ) and wish to continue installation you can create a file in any writable location with contents
inventory_loc=
inst_group=
and run the installer with -invPtrLoc flag.

Eg java -jar -silent -responseFile -invPtrLoc

The log(s) can be found here: /tmp/OraInstall2020-04-07_12-31-12PM.



[root@ol8 u01]# /tmp/createCentralInventory1586233877409.sh /u01/app/oraInventory oinstall
Setting the inventory to /u01/app/oraInventory
Setting the group name to oinstall
Creating inventory pointer file in /etc directory
Creating the Oracle inventory pointer file (/etc/oraInst.loc)
Changing permissions of /u01/app/oraInventory to 770.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete


[oracle@ol8 stage]$ java -jar fmw_14.1.1.0.0_wls.jar -silent \
> ORACLE_BASE=/u01 \
> ORACLE_HOME=/u01/wls14 \
> JAVA_HOME=/usr/java/jdk-11.0.6 \
> INVENTORY_LOCATION=/u01/app/oraInventory \
> INSTALL_TYPE="Complete with Examples"
Launcher log file is /tmp/OraInstall2020-04-07_12-59-41PM/launcher2020-04-07_12-59-41PM.log.
Extracting the installer . . . . . Done
Checking if CPU speed is above 300 MHz.   Actual 2112.000 MHz    Passed
Checking swap space: must be greater than 512 MB.   Actual 4165 MB    Passed
Checking temp space: must be greater than 300 MB.   Actual 24772 MB    Passed
Preparing to launch the Oracle Universal Installer from /tmp/OraInstall2020-04-07_12-59-41PM
Log: /tmp/OraInstall2020-04-07_12-59-41PM/install2020-04-07_12-59-41PM.log
Setting ORACLE_BASE...
Setting ORACLE_HOME...
Setting JAVA_HOME...
Setting INVENTORY_LOCATION...
Setting INSTALL_TYPE...
Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
Skipping Software Updates
Starting check : CertifiedVersions
Expected result: One of oracle-6, oracle-7, redhat-7, redhat-6, SuSE-11, SuSE-12, SuSE-15
Actual Result: oracle-8.1
Check complete. The overall result of this check is: Passed
CertifiedVersions Check: Success.


Starting check : CheckJDKVersion
Expected result: 1.8.0_191
Actual Result: 11.0.6
Check complete. The overall result of this check is: Passed
CheckJDKVersion Check: Success.


Validations are enabled for this session.
Verifying data
Copying Files
Percent Complete : 10
Percent Complete : 20
Percent Complete : 30
Percent Complete : 40
Percent Complete : 50
Percent Complete : 60
Percent Complete : 70
Percent Complete : 80
Percent Complete : 90
Percent Complete : 100

The installation of Oracle Fusion Middleware 14.1.1 WebLogic Server and Coherence 14.1.1.0.0 completed successfully.
Logs successfully copied to /u01/app/oraInventory/logs.

Configuration


[oracle@ol8 bin]$ cd /u01/wls14/oracle_common/common/bin
[oracle@ol8 bin]$ export MW_HOME=/u01/wls14
[oracle@ol8 bin]$ ./commEnv.sh
[oracle@ol8 bin]$ ./wlst.sh

Initializing WebLogic Scripting Tool (WLST) ...

Jython scans all the jar files it can find at first startup. Depending on the system, this process may take a few minutes to complete, and WLST may not return a prompt right away.

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline> readTemplate('/u01/wls14/wlserver/common/templates/wls/wls.jar')
WARNING: The readTemplate is deprecated. Use selectTemplate followed by loadTemplates in place of readTemplate.
wls:/offline/base_domain>cd('Servers/AdminServer')
wls:/offline/base_domain/Server/AdminServer>set('ListenAddress','10.0.2.15')
wls:/offline/base_domain/Server/AdminServer>set('ListenPort', 7001)
wls:/offline/base_domain/Server/AdminServer>create('AdminServer','SSL')
Proxy for AdminServer: Name=AdminServer, Type=SSL
wls:/offline/base_domain/Server/AdminServer>cd('SSL/AdminServer')
wls:/offline/base_domain/Server/AdminServer/SSL/AdminServer>set('Enabled', 'True')
wls:/offline/base_domain/Server/AdminServer/SSL/AdminServer>set('ListenPort', 7002)
wls:/offline/base_domain/Server/AdminServer/SSL/AdminServer>cd('/')
wls:/offline/base_domain>cd('Security/base_domain/User/weblogic')
wls:/offline/base_domain/Security/base_domain/User/weblogic>cmo.setPassword('welcome1')
wls:/offline/base_domain/Security/base_domain/User/weblogic>setOption('OverwriteDomain', 'true')
wls:/offline/base_domain/Security/base_domain/User/weblogic>writeDomain('/u01/wls14/user_projects/domains/DEV_DOMAIN')
wls:/offline/DEV_DOMAIN/Security/DEV_DOMAIN/User/weblogic>closeTemplate()
wls:/offline>exit()


Exiting WebLogic Scripting Tool.


Startup


cd /u01/wls14/user_projects/domains/DEV_DOMAIN/bin
./startWebLogic.sh & 
./startNodeManager.sh &