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.

Friday, July 26, 2013

Web Services

WSDL Elements
Element NameDescription
typesA container for abstract type definitions defined using XML Schema
messageA definition of an abstract message that may consist of multiple parts, each part may be of a different type
portTypeAn abstract set of operations supported by one or more endpoints (commonly known as an interface); operations are defined by an exchange of messages
bindingA concrete protocol and data format specification for a particular portType
serviceA collection of related endpoints, where an endpoint is defined as a combination of a binding and an address (URI)
Types:


The WSDL types element is a container for XML Schema type definitions. 
The basic structure of the types element (with namespaces omitted) is as follows (* means zero or more):
<definitions .... >
    <types>
        <xsd:schema .... />*
    </types>
</definitions>

Messages


The WSDL message element defines an abstract message that can serve as the input or output of an operation. Messages consist of one or more part elements, where each part is associated with either an element (when using document style) or a type (when using RPC style). 
<definitions .... >
    <message name="nmtoken"> *
        <part name="nmtoken" element="qname"? type="qname"?/> *
    </message>
</definitions>

Definition is the root of the WSDL.

Interfaces (portTypes)

It has input and output request. PortType is nothing but an interface which conveys the request and
response parameters.
<definitions .... >
    <portType name="nmtoken">
        <operation name="nmtoken" .... /> *
    </portType>
</definitions>
A portType is still considered an abstract definition because you don't know how its messages are represented on the wire until you apply a binding.

Bindings

The WSDL binding element describes the concrete details of using a particular portType with a given protocol. The binding element contains several extensibility elements as well as a WSDLoperation element for each operation in the portType it's describing.


Tuesday, June 4, 2013

Spring Annotations


 Different Annotations


  • @Autowired
  • @Resource
  • @PostConstruct
  • @PreDestroy
  • @Qualifier
  • @Required
  • @Bean
  • @Component
  • @Service
  • @Repository

http://simplespringtutorial.com/annotations.html

  1.    @Autowired wires by type and @Resource wires by name.
Tomcat

export CATALINA_HOME=/opt/apache-tomcat-6.0.32
export CATALINA_BASE=$BINDIR/..
export JAVA_OPTS="-Xms512m -Xmx2400m -XX:MaxPermSize=512m  -Xdebug -Xrunjdwp:transport=dt_socket,address=9000,server=y,suspend=n"
$CATALINA_HOME/bin/startup.sh


------------
Narsimha Raju
#303,Kinetic Brindavanam, B Block, Sriram Nagar, Near Chirec Public School,Botanical Garden, Kondapur,Hyderabad
Hyderabad, 500084
Andhra Pradesh, India
Mobile: 8019564854

Wednesday, May 22, 2013

Apache Web Server
   1. Checking Apache is installed on our machine or not.
              rpm -q httpd
   2. Main Configuration file is located at
         The main configuration file is /etc/httpd/conf/httpd.conf
   3. ServerRoot
           Serverroot is the path to the server’s configuration, error and log files. The default  location is /etc/httpd.
 4.   Host Configuration
          The hosts file is a computer file used by an operating system to map hostnames to IP addresses. The hosts file is a plain text file, and is conventionally named hosts.
     10.139.64.11    srdcb0042wavec
     10.139.64.12    wc-rpsl-vm1

5. DocumentRoot directive
           DocumentRoot tells you where your web documents (html files, images etc)
should be located. It is possible to reference files in other directories using
aliases and symbolic links. The default directory is /var/www/html.

6. ErrorLog
       ErrorLog tells you where the log containing all server errors is located. This
file is critical for debugging and solving server misconfiguration problems and for
proper traffic shaping. By default, all messages with the value of warning (warn)
and higher will be logged. This is described in the LogLevel directive just below.

The default location is logs/error_log. Please note that this is relative to the
ServerRoot. Therefore, our log file is /etc/httpd/logs/error_log. However, let
us not forget that /etc/httpd/logs is a symbolic link to /var/log/httpd. Thus,
finally, the actual error log is /var/log/httpd/error_log.

7. Listen
        The Listen command tells the Web server what ports to use for incoming connections.
By default, port 80 is used, although any one or several can be used. The
accepted conventions calls for using port 80 for non-secure web communications
(without any encryption of traffic). Secure web communications are normally
handled on port 443.

8. Start the Web Server
          Staring using the following command
              service httpd start
9. Status of the server
                httpd service status or /etc/init.d/httpd status
10. Start Servers
        This directive tells the Web server how many server processes to launch on startup. The default setting is 8 server processes.
11. Min and MaxSpare Servers
           Once started, the Web server dynamically kills and creates processes based on the traffic load, with the number of server processes fluctuating between MinSpareServers and MaxSpareServers. So far, everything figures out just nicely. Now, let’s make another check.

12. Process listing for httpd
                ps -ef | grep httpd
13.












Apache Tuning Parameters
1. Remove ETag
2. KeepAlive
3. PreFork is old one use MPM