星期三, 5月 30, 2018

extract line number between n1 and n2 from a text file

awk:

awk '{if ((NR > n1) && (NR < n2)) print $0}' text_file_name

perl:

perl -ne 'print n1..n2' text_file_name

星期二, 5月 29, 2018

How to simulate process hang in Linux

To simulate the process hang, you can use the kill command with SIGSTOP signal

for example:

kill -SIGSTOP pid

My  case:

I tried to recreate the MQ client process hang and didn't reply the heartbeat packet to qmgr to see we can get what kind of error in qmgr error log.
.
step 1: start MQ client

#./amqsputc LQ1 QM1

step 2: find out the pid

#ps -ef|grep amqsputc

step 3: send SIGSTOP to the pid
#kill -SIGSTOP pid

check the qmgr error log and I can find out the following error message
-----------------------------------------------------
AMQ9271: Channel 'svrconn' timed out.

EXPLANATION:
A timeout occurred while waiting to receive from the other end of channel
'svrconn'. The address of the remote end of the connection was
'192.168.xxx.xxx'.
ACTION:
The return code from the select() [TIMEOUT] 35 seconds call was 4 (X'4').
Record these values and tell the systems administrator.
-------------------------------------------------------

In this case, the qmgr will close the connection due to no response from MQ client after heartbeat interval. The MQ client will report 2009 error (connection broken, reset by peer) after come back from hang issue.

To continue the process, you can use kill with SIGCONT signal.

星期二, 5月 08, 2018

Custom Properties for improving application startup in WebSphere Application Server

Custom Properties for improving application startup in WebSphere Application Server


Problem(Abstract)

In WebSphere Application Server traditional V9.0, Contexts and Dependency Injection (CDI) 1.2 is enabled by default. Enablement of CDI 1.2 might increase unnecessary performance overhead if the application does not use CDI.

Symptom

The application starts slowly.

Resolving the problem

Disable CDI processing steps for applications or archives that do not contain CDI content, and for which the steps are unnecessary. The following Java custom properties and manifest attributes are introduced to disable CDI processing steps:

    Name: com.ibm.ws.cdi.enableImplicitBeanArchives
    Allowed Values: true, false
    Default Value: true
    Description: By setting the com.ibm.ws.cdi.enableImplicitBeanArchives custom property to false, CDI-related annotation scanning steps are disabled for archives that do not contain a bean descriptor, for example, the beans.xml file.

    Name: com.ibm.ws.cdi.enableCDI
    Allowed Values: true, false
    Default Value: true
    Description: By setting the com.ibm.ws.cdi.enableCDI custom property to false, all CDI steps are disabled. Set the value to false if no CDI is needed on the server level.


In addition to these Java custom properties that impact all applications that are deployed to the target server, the following properties can be set in the server-wide amm.filter.properties file and as manifest attributes of application archive files.
    System Property Name: com.ibm.ws.cdi.enableImplicitBeanArchives
    Property and Manifest Attribute Name: Enable-Implicit-Bean-Archive
    System Property Name: com.ibm.ws.cdi.enableCDI
    Property and Manifest Attribute Name: Enable-CDI

Note:
  • The amm.filter.properties file is located at WAS_HOME/properties/amm.filter.properties.
  • Manifest attributes are set as main manifest attributes in Java EE-related application archive files, such as EAR, WAR, RAR, and JAR files.
  • The Enable-CDI property affects an entire application. Set this property on the Manifest.mf file of the application. Setting this property only for a module archive has no effect.

In this way, the property value from the least enclosing scope is used. An attribute value on a module manifest takes precedence over the attribute value on the application. The attribute value on the application takes precedence over a java custom property value. The java custom property value takes precedence over a property value set in the amm.filter.properties file.

For more information about similar properties, see Reducing annotation searches during application deployment in IBM Knowledge Center.