logo
  • Home
  • About Us

Monthly Archives: December 2015

Linux-Some handy commands

How to check which process is using up the most disk resources
iotop -Use the “input output top” command to investigate which process is doing the most IO in real time.

#iotop

Total DISK READ: 0.00 B/s | Total DISK WRITE: 15.57 K/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
946 be/3 root 0.00 B/s 3.89 K/s 0.00 % 0.07 % [jbd2/dm-4-8]
27526 be/4 root 0.00 B/s 3.89 K/s 0.00 % 0.00 % rotatelogs /opt/www/logs/webserver/apache/access_log-%Y-%m-%d-%H 86400
27527 be/4 root 0.00 B/s 3.89 K/s 0.00 % 0.00 % rotatelogs /opt/www/logs/webserver/apache/mod_jk.log-%Y-%m-%d-%H 86400

Capture OS level data to show CPU and Memory usage Thread wise

#top -b -n 1 -H

Or for a specific Process

#top -b -n 1 -H <Process_PID>

Top 10 CPU consuming Process

#ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10

Comparison of CPU utilization

# sar -u 5 10 ( 5 sec of interval & 10 times )

Apache Web Server – How Name based Virtual host works

The ServerName and ServerAlias is more like a company’s internal phone list. Your webserver is the switchboard; it will accept all incoming connections to the server. Then the client/caller will tell them what name they’re looking for, and it will look in the Apache configuration for how to handle that name. If the name isn’t listed as a ServerName/ServerAlias in the apache configuration, apache will always give them the first VirtualHost listed. Or, if there’s no VirtualHost at all, it will give the same content no matter what hostname is given in the request.

So, step by step for a normal connection:
1.  You type “http://www.example.com” into your browser.
2.  Your computer asks its DNS resolver which IP address it should use when it wants to talk to www.example.com.
3.  Your computer connects to that IP address, and says that it wants to talk to www.example.com (that’s the Host:header in HTTP).
4.  The webserver looks at its configuration to figure out what to do with a request for content from www.example.com.

Any one of the following may happen:

  • www.example.com is listed as a ServerName or ServerAlias for a VirtualHost – if so, then it will use the configuration for that VirtualHost to deliver the content.
  • The server doesn’t have any VirtualHosts at all – if so, then it will use the configuration in its httpd.conf to deliver the content.
  • The server has VirtualHosts but www.example.com isn’t listed in any of them – if so, the first Virtualhost in the list will be used to deliver the content.

<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin [email protected]
ServerName abc.com
ServerAlias example.com
…

Apache Virtual Hosting

There are two types Apache Virtual Hosting

Name Based Virtual Hosting

With the name based virtual hosting you can host several domains/websites on a single machine with a single IP. All domains on that server will be sharing a single IP. It’s easier to configure than IP based virtual hosting, you only need to configure DNS of the domain to map it with its correct IP address and then configure Apache to recognize it with the domain names.
A technical prerequisite needed for name-based virtual hosts is a web browser with HTTP/1.1 support (commonplace today) to include the target hostname in the request. This allows a server hosting multiple sites behind one IP address to deliver the correct site’s content. More specifically it means setting the Host HTTP header.

Name

IP Based Virtual Hosting

With the IP based virtual hosting, you can assign a separate IP for each domain on a single server, these IP’s can be attached to the server with single NIC cards and as well as multiple NICs.

IP

JDK VS JRE

JDK-JRE

JRE: Java Runtime Environment– It is basically the Java Virtual Machine where your Java programs run on.If you want to run Java programs, but not develop them, download the Java Runtime Environment.

JDK: Java Development Kit -If you want to develop applications for Java, download the Java Development Kit or JDK. It’s the full featured Software Development Kit for Java, including JRE, and the compilers and tools (like JavaDoc, and Java Debugger) to create and compile programs.

Usually, when you only care about running Java programs on your browser or computer you will only install JRE. It’s all you need. On the other hand, if you are planning to do some Java programming, you will also need JDK.

Sometimes, even though you are not planning to do any Java Development on a computer, you still need the JDK installed. For example, if you are deploying a WebApp with JSP, you are technically just running Java Programs inside the application server. Why would you need JDK then? Because application server will convert JSP into Servlets and use JDK to compile the servlets.

Like Us

Archives

  • December 2015 (4)
  • October 2015 (12)
  • September 2015 (2)

Categories

  • Apache
  • Info
  • Java
  • JBoss
  • Linux
  • Tips&Tricks
  • About Us