Prefork Multi Processing Module for Apache

MPM stands for Multi Processing Module and this module implements a non-threaded pre-forking web server.

MPM isolate each request , so single request wont effect any other request.

MaxRequestWorkers is proportional to Physical RAM. More value more requests so make sure we got more RAM available for that server.

=====How it Works

There is a process named as "Control Process" and it is responsible for launching child process and these child processes will listen for requests and serve them once they arrive. And Apache by default will maintain serveral spare child process so that client request doesn't have to wait until new child process created.

And following parameters are responsible for regulating these child process.
1. StartServers
2.MinSpareServers
3.MaxSpareServers
4.MaxRequestWorkers

The default value for MaxRequestWorkers is 256 , so a server with untouched MaxRequestWorkers parameter can handle 256 requests at a time and you can define your custom value according to your requirement but this proportioanl to availablity of RAM.

To have apache process to bind with port 80 , main parent process will start with root user
but all child process with start with apache to have limited access but all the content that should serve by child process should let them access it. So if some content not accessible , check whether child process which are owned by apache user&group authorized to access that content or not. Noob style just check that folder got owner ship for apache or not.

MaxConnectionsPerChild : Once a child process created , how many requests it can serve before it get killed.

MaxSpareServers Directive
-------------------------

This is the parameter to specify number of spare connection apache control process should create.
Default value is 10 and syntax is as below

Syntax: MaxSpareServers 10

If MaxSpareServers < MinSpareServers , then apache will adjust it MinSpareServers+1 automatically.

If MaxSpareServers > current Idle child/spare process then apache will kill those excessive spare process.

NOTE:
1. Dont ever set this value to a large number
2. If your website is a very busy website, turning off this is a good idea.

MinSpareServer Directive
------------------------

Syntax: MinSpareServers 5

This is the minimum threshold value of number of spare connections. If apache has found less number of spare connection than minimum threshold connections then it will create connections in per socond manner. like

1st second 2^0 connections
2nd second  2^1 connections
3rd second  2^2 connections 

like this it will move till creating 32 connections per second and once it reaches minimum spare connection threshold apache will stop creating spare connections.

Note:
1. Can turn off if your website is a very busy one.
2. Never set this parameter to a large number.

StartServers Directive
----------------------

Syntax: StartServers number

Number of child process should create at the time of Apache startup. And the default differs from
MPM to MPM.

Workder MPM has default value     3
Event  3
prefork                                             5
mpmt_os2                                       2





List of virtual adapters your Virtual Linux can access

Hello ,

Its me again Raja and this time I came up with one more new post.

I have been through interesting problem.

As many of you know Virtual Box , sometimes even though we enable new adapter and configured IP in conf file it wont comes up. Everything seems fine , we have enabled adapter and configured name and IP for it but still it wont come up.

Simple solution : How many adapters your VM able to access can be easily know by using command

                             ls /sys/class/net
  In my case I have 3 adapters so it will display them

root@fresh:~# ls /sys/class/net
enp0s3  enp0s8  lo
root@fresh:~#

If you come across errors like device not found errors , try to found out how your VM identified the adapters that you have enabled.

Hope it helps.

Thank you.

Linux : full path of a file

Hello ,

Sometimes we need to have full or absolute path of file. And most of the times we used to pwd + filename manually.

But with google search I came across a command named as readlink.


readlink -f filename.txt

that will print complete path of filename along with filename append to it.

linuxmen@linuxmen-fresh:~/test/test1$ readlink -f ex4.js
/home/linuxmen/test/test1/ex4.js
linuxmen@linuxmen-fresh:~/test/test1$  

Note : make sure you are same directory where file resides else give relative path to file.

Hope it helps

Install R Programming Language in Ubuntu

This post describe about installation steps for R- Programming Language.

For Windows we have direct exe file but for Linux its in a single click way but you can still do it below commands easily.


Open your terminal and type below commands as root user.


echo "
deb https://cloud.r-project.org/bin/linux/ubuntu xenial/
deb https://cloud.r-project.org/ trusty-backports main restricted universe" >> /etc/apt/sources.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 51716619E084DAB9
sudo apt-get update
sudo apt-get install -y r-base r-base-dev
sudo apt-get install r-cran-boot r-cran-class r-cran-cluster r-cran-codetools r-cran-foreign r-cran-kernsmooth r-cran-lattice r-cran-mass r-cran-matrix r-cran-mgcv r-cran-nlme r-cran-nnet r-cran-rpart r-cran-spatial r-cran-survival r-cran-rodbc

If any questions please dont hesitate to ask.

Thank you.


JVMMON help commands

Hello ,

jvmmon is an excellent tool for JBOSS administrators and please find below list of commands for jvmmon

 Print commands: __________________________

  print arenastat                             - Prints brief arena statistics
  print arenastat full                        - Prints detailed arena statistics
  print class statistic                       - Prints class statistics of a VM
  print cluster memory information            - Prints information about the memory consumption of the cluster
  print codeblobs                             - Prints information about code blobs with specified name
  print debugging information                 - Prints information about the debugging state of a VM
  print detailed class statistic              - Prints detailed class statistics of a VM
  print dll info                              - Prints information about the loaded shared libraries of a VM
  print flight recorder                       - Prints part of the flight recorder of a VM
  print gc history                            - Prints the GC history of a VM
  print hs_err_info                           - Prints the hs-err-info of a VM
  print jit info                              - Prints information about JIT compiler and code cache
  print mallocstat                            - Prints malloc statistics
  print mallocstat internals                  - Prints internals for malloc statistics
  print memhist                               - Prints memory history
  print performance information               - Prints information about the performance of a VM
  print signal handlers                       - Prints currently active signal handlers
  print stacktrace                            - Prints the stacks of all threads in a VM
  print symbol info                           - Prints information about symbols and interned strings of a VM
  print system information                    - Prints system information
  print system properties                     - Prints VM system properties
  print trace flags                           - Prints the active trace flags of a VM
  print virtualization info                   - Prints the platform virtualization info
  print vm compressed class space information - Prints information about the compressed class space of a VM
  print vm information                        - Prints information about a VM
  print vm memory information                 - Prints information about the memory consumption of a VM

__ Dump commands: ___________________________

  dump class statistic                        - Dumps class statistics of a VM
  dump codeblobs                              - Dumps information about code blobs with specified name
  dump detailed class statistic               - Dumps detailed class statistics of a VM
  dump dll info                               - Dumps information about the loaded shared libraries of a VM
  dump gc history                             - Dumps the GC history of a VM
  dump heap                                   - Dumps the heap of a VM
  dump heap with info                         - Dumps the heap and additional information describing the heap of a VM
  dump hs_err_info                            - Dumps the hs-err-info of a VM
  dump jit info                               - Dumps information about JIT compiler and code cache
  dump safepoint state                        - Dumps information about the safepoint state of the specified VM
  dump stacktrace                             - Dumps the stacks of all threads in a VM
  dump stacktrace with info                   - Dumps the stacks of all threads with additional information
  dump symbol info                            - Dumps information about symbols and interned strings of a VM

__ GC commands: _____________________________

  force gc                                    - Forces a full garbage collection
  force max gc                                - Forces a maximum compaction garbage collection
  retrieve complete gc history                - Retrieves the complete GC history of a VM into a local file

__ JIT commands: ____________________________

  compile                                     - Forces compilation of the specified method(s)
  deoptimize                                  - Deoptimizes all activations of the specified method(s)
  deoptimizeall                               - Deoptimizes all methods
  osrcompile                                  - Forces osr compilation of the specified method

__ VM commands: _____________________________

  change command line flag                    - Changes command line flags of a VM
  crash vm                                    - Crashes a VM
  exit vm                                     - Exits a VM
  mallocstat reset                            - Resets malloc statistics value
  mallocstat startcap                         - Starts malloc statistics capture
  mallocstat stopcap                          - Stops malloc statistics capture
  set core size to max                        - Set current soft limit of core size to hard limit
  set debugging port range                    - Sets debugging port range of a VM
  set trace flags                             - Sets trace flags of a VM
  start debugging                             - Starts on-the-fly debugging
  stop command line profiling                 - Stops command line profiling of a VM
  stop debugging                              - Stops on-the-fly debugging

__ VM selection commands: ___________________

  display vms                                 - Displays the VMs in the cluster
  select vm                                   - Selects a VM (in the cluster)
  select vm all                               - Selects all VMs in the cluster

__ Jvmmon commands: _________________________

  exit                                        - Exits Jvmmon
  help                                        - Shows the help text
  history                                     - Shows a list of the commands executed
  print to console                            - Redirect print commands to console output
  print to file                               - Redirect print commands to local file
  quit                                        - Quits Jvmmon
  help ""                            - Displays detailed help about the specified command
  !                                           - Repeats the last command
  !!                                          - Repeats the last command
  !N                                          - Repeats command with number N in history
  !TEXT                                       - Repeats command that started with TEXT



Hope it will helps. 

Python Object reference well explained with list

Assume you have a list and you want to make exact copy of the list.

What command you will use in python to copy a list from another list.

I used List1=List2 and List1 got copied as exactly as List2 but what happen internally is they have shared command object reference location.

Dont believe ? then lets try and try to see both lists location with id function id()

I mean do as  id(List1) and id(List2) , you will find command location for these two which means they are sharing common location and what ever operations you do they will reflect on both lists.And this is completely harmful and dangerous.

So to avoid this list copying can be done in other methods where two list will have two different object locations.

They are

list2=copy.copy(list1)
(or)
list2=list1[:]
(or)
list2=list(list1)

and for more information about object reference understanding in python I recommend you to read these

http://stackoverflow.com/questions/36244451/how-to-program-python-variable-to-point-different-reference-location-but-same-va/36244490#36244490

http://www.python-course.eu/python3_variables.php


How to get full application propery reports by using jvmmon ?

Hello ,

Let come straight to the point.

If you want to see right now with what properties your Jboss application servers are running ,

Please type jvmmon and choose current PID of your JBOSS process.

Then type print system properties

It will flood your stdout , copy and paste it in a file and you can use to analyse.

else

you can save it to a file in your system.

$ print to file
file = /tmp/fromjvmmon
$ print system properties
-- printed to local file /tmp/fromjvmmon
$ exit

and to take thread dump use 

jvmmon
$ print to file
file =/tmp/threaddump
$print stacktrace

it will autosave threaddump in the above location

and similarly to take heap dump. 

type

jvmmon
$dump heap

it will dump heap automatically into location as mentioned in run.conf



Thank you.

Regards
Raja