Load Balancing Interview Questions
Load Balancing Interview Questions
Load Balancing Interview Questions
You need the cookie name, cookie values, the VIP to bind to, and the groups
to balance to.
The Health Check feature of the load balancer that allows you to set
parameters to perform diagnostic observations on the performance of web
servers and web server farms associated with each appliance. Health
checking allows you to determine if a particular server or service is running
or has failed. When a service fails health checks, the SLB algorithm will stop
sending clients to that server until the service passes health checks again.
This depends on the load balancing method that you select. Here are a few
examples:
Least connections (lc) method " The real server with the lowest number of
concurrent connections will receive the first connection. Round robin (rr)
method " The real server with the lowest entry index will get the first
connection. Shortest response (sr) " The loadbalancer or appliance will
establish connections with each server and calculate the round trip time. The
client connection will go to the real server with the lowest response time.
Q: -What is the difference between a Persistent Cookie policy and a
QoS Cookie policy in array network loadbalancer ?
A Persistent Cookie policy selects a group based on the cookie name. A QoS
Cookie policy selects a server group based on the cookie name and value
assigned to that group.
GSLB operates very similarly to SLB, but on a global scale. It allows you to
load balance VIPs from different geographical locations as a single entity.
This provides geographical site fault tolerance and scalability.
Yes, Clustering must be configured and turned on in order to use GSLB. Each
proxy within the site (or cluster) must have the same configuration. Hence,
each appliance can act as a DNS server if it becomes a master for the site.
Each site will have a unique cluster/SLB/GSLB configuration, and you will use
the gslb site overflow command to add the remote GSLB site to the local
appliance.
1. lc " Least connections sends clients to the site that has the least number
of current connections.
2. rr " Round robin simply sends client to each site in round robin succession.
3. overflow " Overflow allows requests to be sent to another (remote) site
when the local site is 80% loaded.
Basic Questions
1. What is initrd image and what is its function in the linux booting process ?
The initial RAM disk (initrd) is an initial root file system that is mounted prior to
when the real root file system is available.The initrd is bound to the kernel and
loaded as part of the kernel boot procedure. The kernel then mounts this initrd
as part of the two-stage boot process to load the modules to make the real file
systems available and get at the real root file system. Thus initrd image plays
a vital role in linux booting process.
In addition to the basic file permissions in Linux, there are few special
permissions that are available for executable files and directories.
SUID : If setuid bit is set, when the file is executed by a user, the process will
have the same rights as the owner of the file being executed.
SGID : Same as above, but inherits group previleges of the file on execution,
not user previleges. Similar way when you create a file within directory,it will
inherit the group ownership of the directories.
Sticky bit : Sticky bit was used on executables in linux so that they would
remain in the memory more time after the initial execution, hoping they would
be needed in the near future. But mainly it is on folders, to imply that a file or
folder created inside a stickybit enabled folder could only be deleted by the
owner. A very good implementation of sticky bit is /tmp ,where every user has
write permission but only users who own a file can delete them.
a) Hardlink cannot be created for directories. Hard link can only be created for
a file.
d) If you remove the hard link or the symlink itself, the original file will stay
intact.
e) Removing the original file does not remove the attached symbolic link or
symlink, but without the original file, the symlink is useless
"mutt" is an opensource tool for sending emails with attachments from the
linux bash command line. We can install "mutt" from the binary rpm or via
packagemanager.
Usage :
umask stands for ‘User file creation mask’, which determines the settings of a
mask that controls which file permissions are set for files and directories when
they are created. While ulimit is a linux built in command which provides
control over the resources available to the shell and/or to processes started by
it.
6. What are the run levels in linux and how to change them ?
A run level is a state of init and the whole system that defines what system
services are operating and they are identified by numbers.There are 7
different run levels present (run level 0-6) in Linux system for different
purpose. The descriptions are given below.
To change the run level, edit the file “/etc/inittab” and change initdefault entry (
id:5:initdefault:). If we want to change the run level on the fly, it can be done
using ‘init’ command.
For example, when we type ‘init 3' in the commandline , this will move the
system from current runlevel to runlevl 3. Current level can be listed by typing
the command 'who -r'
8. What is SeLinux?
The cron is a deamon that executes commands at specific dates and times in
linux. You can use this to schedule activities, either as one-time events or as
recurring tasks. Crontab is the program used to install, deinstall or list the
tables used to drive the cron daemon in a server. Each user can have their
own crontab, and though these are files in /var/spool/cron/crontabs, they are
not intended to be edited directly. Here are few of the command line options
for crontab.
crontab -e Edit your crontab file.
crontab -l Show your crontab file.
crontab -r Remove your crontab file.
******
||||||
| | | | | +-- Year (range: 1900-3000)
| | | | +---- Day of the Week (range: 1-7, 1 standing for Monday)
| | | +------ Month of the Year (range: 1-12)
| | +-------- Day of the Month (range: 1-31)
| +---------- Hour (range: 0-23)
+------------ Minute (range: 0-59)
10. What are inodes in Linux ? How to find the inode associated with a file ?
The following will show the name of each object in the current directory
together with its inode number:
# ls -i
The avialble number inodes in a filesystem can be found using the below
command :
# df -i
The other way we can get the inode details of a file by using the stat
commmand.
Apart from the above basic questions, be prepared for answers for the below
questions
4. How to find kernel / OS version and its supported bit (32/64) version ?
8. Have a look on ps, top, grep, find, awk and dmesg commands ?
Virtual hosts are used to host multiple domains on a single apache instance.
You can have one virtual host for each IP your server has, or the same IP but
different ports, or the same IP, the same port but different host names. The
latter are called "name based vhosts".
n IP-based virtual hosting, we can run more than one web site on the same
server machine, but each web site has its own IP address while In Name-
based virtual hosting, we host multiple websites on the same IP address. But
for this to succeed, you have to put more than one DNS record for your IP
address in the DNS database.
In the production shared webhosting environment, getting a dedicated IP
address for every domains hosted in the server is not feasible in terms of cost.
Most of the customers wont be able to afford the cost of having a dedicated IP
address. Here is the place where the concepts of Name based virtual hosting
find its place.
12. What is network bonding in Linux and where the important configuration
files involved? What is the advantage of Network Bonding ?
There are 7 modes starting from 0 to 6 which decides how the bonding
configuration behaves.
It the default mode. It transmits packets in sequential order from the first
available slave through the last.
This mode provides load balancing and fault tolerance.
mode=1 (active-backup)
Active-backup policy: In this mode, only one slave in the bond is active. The
other one will become active, only when the active slave fails. The bond’s
MAC address is externally visible on only one port (network adapter) to avoid
confusing the switch. This mode provides fault tolerance.
mode=2 (balance-xor)
Transmit the traffic based on [(source MAC address XOR'd with destination
MAC address) modulo slave count]. This selects the same slave for each
destination MAC address. This mode provides load balancing and fault
tolerance.
mode=3 (broadcast)
mode=4 (802.3ad)
Creates aggregation groups that share the same speed and duplex settings.
Utilizes all slaves in the active aggregator according to the 802.3ad
specification.
channel bonding that does not require any special switch support. The
outgoing traffic is distributed according to the current load (computed relative
to the speed) on each slave. Incoming traffic is received by the current slave.
If the receiving slave fails, another slave takes over the MAC address of the
failed receiving slave.
It includes balance-tlb plus receive load balancing (rlb) for IPV4 traffic, and
does not require any special switch support. The receive load balancing is
achieved by ARP negotiation.
/etc/sysconfig/network-scripts/ifcfg-bond0
/etc/modprobe.d/bonding.conf
/etc/sysconfig/network-scripts/ifcfg-eth[0-4]
/proc/net/bonding/bond0
6) Reboot your system, remove bootable CD and we should have the boot
menu ready when the system starts.
Note : There would be slight difference when using with other distros.
The /etc/shadow file stores actual password in encrypted format with some
additional properties related to user password.It mainly holds athe account
aging parameters. All fields are separated by a colon (:) symbol. It contains
one entry per line for each user listed in /etc/passwd file Generally, shadow
file entry looks as below.
steve:$1$XOdE07rn$WA6qFm4W5UIqNfaqE5Uub.:13775:0:99999:7:::
Last password change : Days since Jan 1, 1970 that password was last
changed
Warn : The number of days before password is to expire that user is warned
that his/her password must be changed
Inactive : The number of days after password expires that account is disabled
steve:x:6902:6902::/home/steve:/bin/bash
User ID (UID): Each user must be assigned a user ID (UID). UID 0 (zero) is
reserved for root.
Home directory: The absolute path to the directory the user will be in when
they log in.
15. How do you boot your system into the following modes, when you are in
some trouble ?
a) Rescue mode
b) Single user mode
c) Emergency mode
Rescue mode provides the ability to boot a small Linux environment from an
external bootable device like a CD-ROM, or USB drive instead of the system's
hard drive.Rescue mode is provided to help you with your system from
repairing the file system or fixing certain issues which prevent your normal
operations.
In order to get into the rescue mode, change the BIOS settings of the machine
to boot from the external media. Once the system started booting
using bootable disk, add the keyword rescue as a kernel parameter or else
you can give the parameter "linux rescue" in the graphical boot interface.
In single-user mode, the system boots to runlevel 1, but it will have many
more additional functionalities compared to switching to runlevel 1 from other
levels.
The local file systems can be mounted in this mode, but the network is not
activated.
1) At the GRUB splash screen during the booting process, press any key to
enter the GRUB interactive menu.
2) Select the proper version of kernel that you wish to boot and type "a" to
append the line.
3) Go to the end of the line and type "single" as a separate word.
4) Press Enter to exit edit mode and type "b" to boot into single usermode
now.
In emergency mode, you are booting into the most minimal environment
possible. The root file system is mounted read-only and almost nothing is set
up. The main advantage of emergency mode over single-user mode is that the
init files are not loaded. If the init is corrupted , you can still mount file systems
to recover data that could be lost during a re-installation. To boot into
emergency mode, use the same method as described for single-user mode,
with one exception, replace the keyword single with the keyword "emergency".
16. In the ps results few of the processes are having process state as "D" .
What does it mean ? Briefly explain different process states ?
To have a dynamic view of a process in Linux, always use the top command.
This command provides a real-time view of the Linux system in terms of
processes. The eighth column in the output of this command represents the
current state of processes. A process state gives a broader indication of
whether the process is currently running, stopped, sleeping etc.
Apart from these four states, the process is said to be dead after it crosses
over the zombie state; ie when the parent retrieves its exit status. ‘Dead’ is not
exactly a state, since a dead process ceases to exist.
Cache in Linux memory is where the Kernel stores the information it may need
later, as memory is incredible faster than disk.
It is great that the Linux Kernel takes care about that.Linux Operating system
is very efficient in managing your computer memory, and will automatically
free the RAM and drop the cache if some application needs memory.
Kernels 2.6.16 and newer provide a mechanism to have the kernel drop the
page cache and/or inode and dentry caches on command, which can help free
up a lot of memory. Now we can throw away that script that allocated a ton of
memory just to get rid of the cache.
To free pagecache:
To improve the system security even further, most of the organizations turned
to use keybased authentications instead of Password based
authentication. We can enforce the key-based authentication by disabling the
standard password authentication, which involves a public key private key
pair. The public key is added in the server configuration file while private key
is kept kept confidential on the client side.
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/steve/.ssh/id_rsa):
b) Press Enter to confirm the default location (that is, ~/.ssh/id_rsa) for the
newly created key.
2) Now on your client side, open the remote connection agent like putty and
browse your public key and try SSH to the server, you should be able to login
without a password now.
# ssh server1.myserver.com
The authenticity of host 'server1.myserver.com (192.168.44.2)' can't be
established.
RSA key fingerprint is e3:c3:89:37:4b:94:37:d7:0c:d5:6f:9a:38:62:ce:1b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'server1.myserver.com' (RSA) to the list of
known hosts.
Last login: Tue July 13 12:40:34 2014 from server2.myserver.com
3) Public key authentication can prevent brute force SSH attacks, but only if all
password-based authentication methods are disabled. Once public key
authentication has been confirmed to be working, disable regular password
authentication by editing /etc/ssh/sshd_config and set the following option to
"no".
PasswordAuthentication no
The TCP three way handshake is the process for establishing a TCP
connection.We can explain 3 way handshake with a simple scenario where we
assume a client computer is contacting a server to send it some information.
a) The client sends a packet with the SYN bit set and a sequence number of
N.
b) The server sends a packet with an ACK number of N+1, the SYN bit set
and a sequence number of X.
c) The client sends a packet with an ACK number of X+1 and the connection
is established.
d) The client sends the data.
The first three steps in the above process is called the three way handshake.
20. As the disk space utilization was so high in the server, the Administrator
has removed few files from the server but still the disk utilization is showing
as high. What would be the reason ?
In Linux even if we remove a file from the mounted file system, that will still be
in use by some application and for this application it remains available. Its
because file descriptor in /proc/ filesystem is held open..So if there are such
open descriptors to files already removed, space occupied by them
considered as used. You find this difference by checking them using the "df"
and "du" commands. While df is to show the file system usage, du is to report
the file space usage. du works from files while df works at filesystem level,
reporting what the kernel says it has available.
You can find all unlinked but held open files with:
This will list the filename which is open witht he pid in which it is running. We
can kill those Pids and which will stop these process and will recover the disk
space responsible for this file.
21. What is rDNS and explain its benefits in the Linux Domain Name Systems
?
22. What is sosreport, how do you generate it while working with your Redhat
Support Team in production ?
# sosreport
~$ cat /proc/sys/vm/swappiness
60
If we have enough RAM, we can turn that down to 10 or 15. The swap file will
then only be used when the RAM usage is around 80 or 90 percent.
You can also change the value while your system is still running
sysctl vm.swappiness=10
We can also clear swap by running swapoff -a and then swapon -a as root
instead of rebooting to achieve the same effect.
Git is a very popular and efficient open source Version Control System. It
tracks content such as files and directories. It stores the file content in BLOBs
- binary large objects. The folders are represented as trees. Each tree
contains other trees (subfolders) and BLOBs along with a simple text file
which consists of the mode, type, name and Secure Hash Algorithm of each
blob and subtree entry. During repository transfers, even if there are several
files with the same content and different names, the GIT software will transfer
the BLOB once and then expand it to the different files.
Inode is a data structure that keeps track of all the information about a file.
When we keep our information in a file and the OS stores the information
about a file in an inode. Information about files is sometimes called metadata.
We can say that an inode is metadata of the data. In a file system, inodes
consist roughly of 1% of the total disk space, whether it is a whole storage unit
or a partition on a storage unit. The inode space is used to ?track? the files
stored on the hard disk. The inode entries store metadata about each file,
directory or object, but only points to these structures rather than storing the
data. Each entry is 128 bytes in size. The metadata contained about each
structure can include the following:
Inode number
Access Control List (ACL)
Extended attribute
Direct/indirect disk blocks
Number of blocks
File access, change and modification time
File deletion time
File generation number
File size
File type
Group
Number of links
Owner
Permissions
Status flags
Similar way, the number of inodes allocated, used and free in a Filesystem
can be listed using "df -i" command
# df -i /root
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/RootVol-lvmroot
524288 80200 444088 16% /