Menu

Tuesday, 22 May 2018

Apache HTTP Server

What is Web Server ?
A web server is a system or software that delivers content or services to end users over the internet. A web server consists of a physical server, server operating system (OS) and software used to facilitate HTTP communication. 

 Types of Web Servers :-

  • Apache (provided by Apache)
  • IIS (provided by Microsoft)
  • nginx (provided by NGINX)
  • lighttpd

Apache HTTP Server 

Apache web server is a software application , which is most widely  used as a web server application in the world. Since it was officially released in 1995. In 2009,it became the first web server software to serve more than 100 million websites.  Approx 45 % of active sites are running on Apache web server application.Many organizations rely on Apache, including PayPal, Cisco, Apple, and, of course, the Apache Software Foundation.

It is a modular, process-based web server application that creates a new thread with each simultaneous connection.
It supports a number of features; many of them are compiled as separate modules and extend its core functionality, and can provide everything from server side programming language support to authentication mechanism.

Apache uses one of following MPM (Multi-Processing Module) for handling incoming requests and processes them. It modifies basic functionality of the Apache server related to multi-thread and multi-processes style of working. Only one MPM can be loaded into the server at any time.

Types of MPM’s :-
Below is some basic details about MPM’s and there functionality.


Prefork MPM:- Prefork MPM launches multiple child processes. Each child process handle one connection at a time. Prefork uses high memory in comparison to worker MPM. Prefork is the default MPM used by Apache server. Prefork MPM always runs few minimum (MinSpareServers) defined processes as spare, so new requests do not need to wait for new process to start. It is higher memory consumption and lower performance over the newer Apache 2.0-based threaded MPM’s. It is Apache 1.3 based.

Worker MPM:- Worker MPM generates multiple child processes similar to prefork. Each child process runs many threads. Each thread handles one connection at a time.
In sort Worker MPM implements a hybrid multi-process multi-threaded server. Worker MPM uses low memory in comparison to Prefork MPM and has higher performance. It is Apache 2.0 based.

Event MPM:- It is pretty similar to worker MPM but it designed for managing high loads.
This MPM allows more requests to be served simultaneously by passing off some processing work to supporting threads. Using this MPM Apache tries to fix the ‘keep alive problem’ faced by other MPM. When a client completes the first request then the client can keep the connection open, and send further requests using the same socket, which reduces connection overload.

Prefork MPM
·         Each request/connection is handled by a process
·         Multi-processes; 1 thread per process
·         Each request is handled by a different process.
·         This MPM is chosen mainly for stability and security.
·          
Worker MPM
·         Each request/connection is handled by a thread
·         Multi-processes; multiple threads per process
·         This MPM is chosen for better performance and lower memory consumption.
·          
Event MPM
·         It has been finally declared stable in Apache 2.4.
·         The way it function is similar to the Worker MPM.
·         it will assign a thread to a request.


MPM Specific :-

StartServers
StartServers sets how many server processes are created upon startup.

MaxRequestsPerChild
MaxRequestsPerChild sets the total number of requests each child server process serves before the child dies.

MaxClients
MaxClients sets a limit on the total number of server processes, or simultaneously connected clients, that can run at one time.

MinSpareServers and MaxSpareServers
These Values are only used with the prefork MPM.

The MaxSpareServers directive sets the desired maximum number of idle child server processes. An idle process is one which is not handling a request. If there are more than MaxSpareServers idle, then the parent process will kill off the excess processes..

The MinSpareServers directive sets the desired minimum number of idle child server processes. An idle process is one which is not handling a request. If there are fewer than MinSpareServers idle, then the parent process creates new children

MinSpareThreads and MaxSpareThreads
These values are only used with the worker MPM. The server checks the number of server threads waiting for a request and kills some if there are more than MaxSpareThreads or creates some if the number of servers is less than MinSpareThreads.

ThreadsPerChild
This value is only used with the worker MPM. It sets the number of threads within each child process.
The default value for this directive is 25.

Listen
The Listen command identifies the ports on which the Web server accepts incoming requests.

Include
Include allows other configuration files to be included at runtime.

User
The User directive sets the user name of the server process and determines what files the server is allowed to access.

Group
Specifies the group name of the Apache HTTP Server processes.

ServerName
ServerName specifies a hostname and port number for the server.

VirtualHost
<VirtualHost> and </VirtualHost> tags create a container outlining the characteristics of a virtual host. The VirtualHost container accepts most configuration directives.

Command to check MPM : httpd –V      

Below configurations are extracted from httpd.conf :-

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxRequestWorkers: maximum number of server processes allowed to start
# MaxConnectionsPerChild: maximum number of connections a server process serves
#                         before terminating
<IfModule mpm_prefork_module>
    StartServers             5
    MinSpareServers          5
    MaxSpareServers         10
    MaxRequestWorkers      250
    MaxConnectionsPerChild   0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestWorkers: maximum number of worker threads
# MaxConnectionsPerChild: maximum number of connections a server process serves
#                         before terminating
<IfModule mpm_worker_module>
    StartServers             3
    MinSpareThreads         75
    MaxSpareThreads        250
    ThreadsPerChild         25
    MaxRequestWorkers      400
    MaxConnectionsPerChild   0
</IfModule>

# event MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestWorkers: maximum number of worker threads
# MaxConnectionsPerChild: maximum number of connections a server process serves
#                         before terminating
<IfModule mpm_event_module>
    StartServers             3
    MinSpareThreads         75
    MaxSpareThreads        250
    ThreadsPerChild         25
    MaxRequestWorkers      400
    MaxConnectionsPerChild   0
</IfModule>




Refrence link :



Thanks :-)

Monday, 21 May 2018

SSL on JBOSS 7.1 Admin console & Application.

Step 1: Locate to JBOSS /configuration folder.

Screenshot  :


Step 2: open standalone.xml file.  NOTE : Always take backup before doing any config. changes.

Command >> vim  standalone.xml


Step 3: Add below parameters for ssl on Application and Management.

where,
              "ManagementRealm" is belongs to Admin Console.
"ApplicationRealm" is belongs to Application.


Screenshot :




Step 4 : Add below changes for "ApplicationRealm".

Screenshot :


Screenshot  :




Step 5 : Add below changes for "ManagementRealm".

Screenshot :


Add below changes from <socket-binding http="management-http"/>  tag to <socket-binding https="management-https"/>

<management-interfaces>
             <http-interface security-realm="ManagementRealm">
               <http-upgrade enabled="true"/>
               <socket-binding https="management-https"/>
             </http-interface>
        </management-interfaces>
 
 
Screenshot  :



Screenshot  :






Thanks :-)



Tuesday, 1 May 2018

What is MustGather script ?

If you face any performance degradation, hang, no response, hung threads, CPU starvation, high CPU utilization, network delays, or deadlocks, this MustGather will assist you in collecting the critical data that is needed to troubleshoot your issue.

Use below link and download MustGather document as per your environment.

http://www-01.ibm.com/support/docview.wss


MustGather: Performance, hang, or high CPU issues on Windows

Step 1 : Download the windowsperf.jacl script. This script works for WebSphere Application Server version 6.1 to version 9.1.

windowsperf.jacl

Screenshot :



Step 2 :  Use below command from WebSphereApplication home\bin:
Syntax :
wsadmin -lang jacl -javaoption -Xmx256M -f <path to file>\windowsperf.jacl servername <nodename if needed> 

Screenshot :



Step 3 : Check the javacore files of same server.

Screenshot :






















Step 4 :Check the set of javacores, tasklist, netstat, and some performance.

Screenshot :
Note: the number of iterations and the pause time between collections are the first 2 executable lines in the script, The variable iters is the number of iteration and the ptime variable is the pause time .
normally this is set to 3 iterations and 120 second ptime as below: 
set iters 3
set ptime 120



Ref doc : https://www-01.ibm.com/support/docview.wss


PsList to troubleshoot high CPU usage in Windows - WebSphere® Application Server

While troubleshooting high CPU utilization in IBM WebSphere® Application Server on Windows operating systems, the perfmon tool may not provide enough information. The PsList tool can be used to collect CPU usage about individual threads in the Java process. PsList is a light-weight tool bundled in the PsTools utilities provided by Microsoft.

Before you restart the server always collect the logs.

Step 1: Download PsTools.zip from the below link:

https://docs.microsoft.com/en-us/sysinternals/downloads/pstools

Screenshot :



Step 2: Unzip the contents of PsTools.zip to a local directory. This will extract a couple of .exe files, one of which will be PsList.exe.

Screenshot :



Step 3: Copy the attached startpslist.bat file to the same directory as the output of the extracted PsTools.zip. This simple script is provided to automatically run PsList and collect its data. By default, it runs PsList.exe every 5 seconds. This interval can be changed by editing the TIME_SLEEP value in the script.


Use below link to download startpslist.bat & startpslistYYYYMMDD.bat

http://www-01.ibm.com/support/docview.wss?rs=180&uid=swg21304776

Screenshot  :




Step 4: Run the command: startpslist.bat [Java Process ID] at same time run MustGather script and terminate using CTRL+C.

Screenshot  :



MustGather script





Step 5 : Locate  the same location directory for pslistlog.PID.yyyy.mm.dd.hh.mm.ss

Screenshot  :