Monday, November 11, 2013

Mysql parameters



innodb_log_file_size = 1536M
innodb_flush_log_at_trx_commit = 0
innodb_buffer_pool_size = 12G (75% of 16G)

Thursday, November 7, 2013

Linux commands

Stress Testing linux commands
1. sar  System activity reporter
sar -u 12 5
  -u 12 5: Comparison of CPU utilization; 12 seconds apart; 5 times.
 


2. vmstat
Procs – r: Total number of processes waiting to run
Procs – b: Total number of busy processes
Memory – swpd: Used virtual memory
Memory – free: Free virtual memory
Memory – buff: Memory used as buffers
Memory – cache: Memory used as cache.
Swap – si: Memory swapped from disk (for every second)
Swap – so: Memory swapped to disk (for every second)
IO – bi: Blocks in. i.e blocks received from device (for every second)
IO – bo: Blocks out. i.e blocks sent to the device (for every second)
System – in: Interrupts per second
System – cs: Context switches
CPU – us, sy, id, wa, st: CPU user time, system time, idle time, wait time

3. vmstat -a
Iostat command reports CPU and I/O statistics. iostat command is used during performance analysis to narrow down the problematic areas in the system.

4. Sample output of iostat command and its explanation:

  iostat
Linux 2.6.31-17-generic (sathiya-laptop)     05/25/10     _i686_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          25.99    0.78    7.43   12.77    0.00   53.03

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda              27.40       797.19       201.27     800902     202208
sr0               0.03         1.24         0.00       1248          0


The first three columns of the CPU report show the percentage of CPU utilization that occurred while executing at the user level (applications), at the user level with a nice priority, and at the system level (kernel), respectively. The last two columns show the percentage of time the CPU was idle while it had an outstanding disk I/O request and while it did not have an outstanding disk I/O request.

The first line displays general information — Linux kernel version, hostname etc.,

Next two lines displays CPU statistics, in which the first 3 column displays average CPU usage. The 4th column displays the percentage of time the CPU were idle and waited for I/O response. 5th column displays percentage of waiting time of virtual CPU. 6th column displays the percentage of time the CPU is idle.


%util : Percentage of CPU time during which I/O requests were issued to the device (bandwidth utilization for the device). Device saturation occurs when this value is close to 100%.

Remaining line displays the device utilization report. First line in that is headers, such as number of Transfer per second, number of blocks read per second, blocks write per second, total block reads, total block writes.





5. cat 1_100_031020130456| awk '{ print $9 }' | cut -c27-30 | sort  | less
6. cat t | grep -o -e "\- Count=.*\,"   | c

 7. cat t | egrep   -o "9000000[0-9][0-9][0-9]" | sort | uniq --count
 8. grep  "SUCCESS" 1_1000_031020130456 |awk '{ print $9$10 }' | cut -d ',' -f 3 | cut -d '=' -f 2 | sort | less



9. grep "FAILURE" 12_10000_12102013 | awk '{print $11}' | sort | uniq --count



10. sar -n SOCK 60 >sar_Mixed_60 &   To see no of files open


11. top -p <pid>
 shift h
 To know java process where pid is process java process id


Java Commands

Java Tuning

jstat -gcutil -t <Process_id> 1000
         To know the status of  GC. 
jmap -heap <Proces ID of your JVM>         Heap Size
jmap -histo:live 18281 | head
          classes used for

Java Command running
java -cp lib/WEB-INF/lib/*:/home/wcuser/stubs/lib/WEB-INF/classes:. wavecrest.stubs.BillDeskStubServer &


Kill -3 pid to take thread dump u can redirect it to a file.


export JAVA_OPTS="-Xms1536m -Xmx4096m -XX:MaxPermSize=256m -Xmn1024m -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCApplicationStoppedTime -XX:+HeapDumpOnOutOfMemoryError -XX:+AggressiveOpts -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=10.10.18.200 -Dsun.rmi.dgc.server.gcInterval=120000 -Xloggc:./gclog -verbose:gc -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+UseParallelOldGC -XX:+UseAdaptiveSizePolicy -XX:MaxGCPauseMillis=100"


It is possible to instruct the JVM to create automatically a heap dump in case that it runs out of memory, i.e. in case of a OutOfMemoryError error. To instruct the JVM to create a heap dump in such a situation, start your Java application with the -XX:+HeapDumpOnOutOfMemoryError option.