Archive

Posts Tagged ‘apache’

Apache Performance Tuning on Linux – So many options

December 7th, 2011 No comments

Apache is common types of web server that have made balance among the entire setting and performance of the server. It is also help protect the server from the swap files. It is also playing a major role to increasing the performance of the server. It is also best option for the Linux users to get number of additional options by using through it. It is also help the server administrator to increasing the performance of the Linux system. On the other, it is also solve the issue of RAM that much essential to enhance the performance of the Web server

The procedure to do this is simple: decide size of the average Apache process, just by looking at the process list through tool like top, and divide it in the total available memory, and leaving a few rooms for some other processes. Beyond this rest is mundane: get the fast enough CPU, fast network card as well as enough of disks, where the “fast enough” is something, which has to get determined by the experimentation. The operating system option is largely the matter of the local concerns. However, some guidelines have proven normally useful are:

Run latest stable release & patch level of operating system, which you select. Lots of OS suppliers have also introduced some significant performance improvements to the TCP stacks as well as thread libraries in the recent years.

In case, OS supports a sendfile system call, ensure that you install release or patches required to enable that. (With Linux, example, it means making use of Linux 2.4 and later. For the early releases of the Solaris 8, you might have to apply the patch.) On the systems where it is accessible, sendfile allows Apache 2 to deliver the static content faster as well as with the lower CPU utilization. For the best performance, thus, make use of IP addresses, instead of names, while using the directives, in case, possible.

Categories: General Tags:

Using Lighttpd, Nginx and other Web Servers on Linux – Offering Best Flexibility to the Linux User!

September 6th, 2011 No comments

The Apache HTTP sever is far better and well known web server on the internet, which is used by most of the Linux users. Comparing to other web server the Apache web server is offering best flexibility to the Linux system.

Apache’s security and flexibility is one of the foremost reasons why web server administrators choose it over the long run. Configuration of Apache web server is well documented and if you are very new to the web server, then Apache is probably the best place to begin. It is available in the default package on several Linux systems.

It is as well good to note it is the cross platform as well as can run on Windows & Linux systems. Rounding out top of list we have other web server program, Google (who makes use of their private custom server application), nginx & lighttpd. Three I can detail as best Linux server software are nginx, lighttpd, as well as Apache.

lighttpd

Lighttpd (pronounced as “Lighty”) was born from the desire to make the fast, and secure or reliable web server with the small memory footprint. Also, from the functional standpoint that works much same as the Apache, widely used web server with very less memory that is used on the busy servers & greater throughput while pushed to the limit. It powers many high traffic sites like YouTube and Wikipedia.

Configuration is completely very same to the Apache (that most of the people are been used to) but syntax is different. The documentation is thorough and can guide you any set up tasks you require. There are a lot of how tos accessible online that will help you through setup of server that depends on the OS or else you may check Google for the specific details. Best how tos are accessible over at Howtoforge & you might have to do a few Googling to find out the specific instructions for the situation.

 

Categories: General Tags: , ,

Performance Tuning Apache web server on Linux – Considered as the Best One!

July 31st, 2011 No comments

Are you looking for the best web server on Linux? Well, it’s the Apache web server which is popularly used by the users. This web server has been designed to offer a balance of flexibility, portability, and performance.

You can avail the Apache in different version like 1.3 and 2.x. One of the most important details that Apache is fully based on RAM. It is the best option for you to use the Apache web server in your web site. Due to huge benefits and great advantages, the Apache has considered as one of the best and superb web server among all.

There are a lot of other httpd.conf tips.

The brief & quite complete set of the Apache Tuning by Kurt and in case, you are very comfortable patching the Apache 1.3 sources, and try lingerd. Every Apache procedure at present, wastes lots of time “lingering” on the client connections, and after this page is generated & sent.

Lingerd takes over the job, leaving Apache process instantly free to handle the new connection. Thus, Lingerd makes that likely to serve same load by using the considerably lesser Apache processes. Increase SendBufferSize in the httpd.conf to size of the largest page. Increase the kernel’s TCP or IP write buffer size.

HotWired’s: Tuning the Apache Web Servers for the Speed. Sterling Hughes & Andrei Zmievski have a few good advice in the Advanced PHP presentation (do not miss section on Squid at an end of slides). Ron Chmara’s advice to tune Apache while using the PHP’s persistent database: do not set MaxRequestsPerChild very high thus idle sources are quickly released.

Caching Tutorial for the Web Authors & Webmasters by the Mark Nottingham teaches you how you can make the browsers cache content. In case, you are brave soul, then you may as well apply the Silicon Graphics’ Accelerated patches. “It project’s the aggressive optimizations make the Apache/1.3 to 10 times faster & Apache/2.0 up to 4 times faster on SPECweb96 benchmark.” Bradley J.

Categories: linux Tags:

Performance Tuning Apache web server on Linux – Speed ‘em up!

July 24th, 2011 No comments

This is really critical to select the best web server on Linux. There are numbers of other web servers available which truly designed to offering quality services and features.

If you want to look for the best web server, then you have the option to choose the Apache. This server is purely designed with prominent features. Now, you can use the Apache in several versions like 1.3 and 2.x. the hardware system of this server is truly based on RAM.

Before using the Apache versions, you need to consider the best quality and specification of it.  Now, you can collect some other information about the Apache web server from online.  Bartram talks of making use of flood to stress the test apache and general monitoring & tuning advice.

Official Apache Performance documentation and good stuff, and verbose. Sascha Schumann of PHP development team suggests compiling PHP4 with following settings

–enable-inline-optimization –disable-debug

Hints to optimize Linux, Linux & Solaris and set no time attribute for accessed files. Or Unix systems can record last file access time and it is the useful setting for the web pages. Here is how you can change on Linux & Solaris. Make use of Ramdisk to store the temporary files (for example session variable files). Ramdisk howto.

Mr Perkins points that for the Linux 2.4/Solaris, instead of making the ramdisk, by using tmpfs is effective since it will not ask for all ram straight away, in case, machine becomes busy ram is freed & swap is been used. Following command sets up file system over the existing /tmp (and where the php stores cookie information by default):

mount tmpfs /tmp -t tmpfs -o size=64m

Scaling Apache 2.0 and discusses ftp.heanet website and it serves the content through HTTP, FTP & RSYNC all accessible through IPv4 & IPv6. Includes some advice to tune OS and scalable Internet Architectures, extensive presentation that was expanded later in book of same name by the Theo Schlossnagle.

Categories: linux Tags:

How To: internal dummy connection in Apache

November 3rd, 2010 No comments

You’ve probably seen internal dummy connection in your Apache log file and must be wondering what the heck is it and why is happening so constantly?

Well, the reason you’re seeing that your Apache access_log is because it’s part of managing the child processes and wakes itself up by sending a request to itself.  This is purely harmless and by feature and if it’s annoying you, then simply disable it in your CustomLog directive in Apache config.

Categories: linux Tags: ,

Tool of the week: p2pd

July 1st, 2010 2 comments

I came across p2pd and read it’s documentations briefly.  I really like the idea behind it as it uses the p2p mindset and architecture to extend on video streaming either by using native HTTP or SPP (Streaming Peer-to-Peer Protocol).

I’m more interested in utilizing the using HTTP piece where clients are not required to install and utilize any special protocols/tools in order to take advantage of p2pd.

Overview

Problem description: A content provider wishes to build a CDN for hosting (large) high quality video files for VoD streaming, and is assumed to already have a generic HTTP server (such as Apache) for web pages which will handle all all non-video presentation. The p2pd based CDN is only to be used to distribute the video data, after video playback has been requested. A separate media player application will handle decoding of the video once it has been received at the client machine.

The p2pd based CDN can consist of two types of nodes; servers and caches (SCC nodes). The servers keep media files in the directory /mediafiles, which is used to publish files. The caches store downloaded files in the directory /cachefiles. All p2pd processes are here assumed to run on port 8080. A file movie.mpg distributed by the CDN would have the URL http://cdn.example.com:8080/movie.mpg.

The machines available for building the CDN are assumed to have IP addresses in the range 10.0.0.1 – 10.0.0.5, with the DNS name cdn.example.com pointing to the nodes that should be accessible by users.

Users should not be required to download any additional software, but be able to use any web browser that supports HTTP.

As described above in p2pd HTTP documentation, having Apache is sufficient out of the box to build a CDN environment to stream VoD (video-on-demand).  it follows a model of server and caching servers.  You’d have a single server containing the primary content and as many caching servers from which connections are made to internal server containing the content if assets are not in cache.  The caching server IPs can be setup in DNS round-robin scenario to load balance them or a VIP on a hardware based device.

I think the above scenario can easily work for non-streaming purposes as well.  I haven’t tested this tool but assuming the expansion of CDN works well, there is no difference serving progressive http download of mpeg assets or html/css/php etc. sites.  The caching servers would use Apache and as long as that web server can run dynamic scripts (i.e php/perl etc), then building a large CDN using this same scenario would work for anything.

Categories: tools Tags: , ,

The Ultimate Linux Reference Guide for Newbies

November 24th, 2009 2 comments
The Ultimate Linux Reference Guide for Newbies
Click Here to download the Ultimate Linux Guide PDF!
FILE AND DIRECTORY BASICS This cateogry also includes utilities that change file/directory properties and permissions
ls List files/directories in a directory, comparable to dir in windows/dos.
ls -la Shows all files (including ones that start with a period), directories, and details attributes for each file.
ls -lSrh Find the biggest files in current directory in human readable format.
cd Change directory (e.g cd /usr/local/bin)
cd ~ Go to your home directory
cd - Go to the last directory you were in
cd .. Go up a directory
cat Print file contents to the screen
cat filename.txt Print the contents of filename.txt to your screen
du -kx | egrep -v “\./.+/” | sort -n Find largest directories in the filesystem.
tail Similar to cat, but only reads the end of the file
tail /var/log/messages See the last 20 (by default) lines of /var/log/messages
tail -f /var/log/messages Watch the file continuously, while it’s being updated
tail -200 /var/log/messages Print the last 200 lines of the file to the screen
head Similar to tail, but only reads the top of the file
head /var/log/messages See the first 20 (by default) lines of /var/log/messages
head -200 /var/log/messages Print the first 200 lines of the file to the screen
more Llike cat, but opens the file one screen at a time rather than all at once
more /etc/userdomains Browse through the userdomains file. hit Spaceto go to the next page, q to quit
less Page through files
od View binary files and data
xxd Also view binary files and data
gv View Postscript/PDF files
xdvi View TeX DVI files
nl Number lines
touch Create an empty file
touch /home/burst/public_html/404.html Create an empty file called 404.html in the directory /home/burst/public_html/
file Attempts to guess what type of file a file is by looking at it’s content.
file * Prints out a list of all files/directories in a directory
cp Copy a file
cp filename filename.bak Copies filename to filename.bak
cp -a /etc/* /root/etc/ Copies all files, retaining permissions form one directory to another.
cp -av * ../newdirectory Copies all files and directories recurrsively in the current directory INTO newdirectory
mv Move a file command
mv oldfilename newfilename Move a file or directory from oldfilename to newfilename
rm delete a file
rm filename.txt deletes filename.txt, will more than likely ask if you really want to delete it
rm -f filename.txt deletes filename.txt, will not ask for confirmation before deleting.
rm -rf tmp/ recursively deletes the directory tmp, and all files in it, including subdirectories.
chmod Changes file access permissions. The set of 3 go in this order from left to right: USER – GROUP – EVERONE 0 = — No permission 1 = –X Execute only 2 = -W- Write only 3 = -WX Write and execute 4 = R– Read only 5 = R-X Read and execute 6 = RW- Read and write 7 = RWX Read, write and execute
chmod 000 No one can access
chmod 644 Usually for HTML pages
chmod 755 Usually for CGI scripts
chown Changes file ownership permissions The set of 2 go in this order from left to right: USER – GROUP
chown root myfile.txt Changes the owner of the file to root
chown root.root myfile.txt Changes the owner and group of the file to root
stat Display file attributes
grep Llooks for patterns in files
grep root /etc/passwd Shows all matches of root in /etc/passwd
grep -v root /etc/passwd Shows all lines that do not match root
ln Create’s “links” between files and directories
ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf Now you can edit /etc/httpd.conf rather than the original. changes will affect the orginal, however you can delete the link and it will not delete the original.
wc Word count
wc -l filename.txt Tells how many lines are in filename.txt
find Utility to find files and directories on your server.
find / -name “filename” Find the file called “filename” on your filesystem starting the search from the root directory “/”.
locate filename Find the file name and path of which contains the string “filename”. Run ‘updatedb’ to build index.
rename .html .php *.html Rename all *.html file as *.php
for file in *.html ; do mv $file `echo $file | sed ‘s/\(.*\.\)html/\1php/’` ; done Rename all *.html files as *.php
Of course this is more work than previous command…why bother.
find . -uid 320 -exec chown 350 {} \; Change all files with uid 320 to 350.
For all real life find examples check out:

http://johnmeister.com/CS/UNIX/FIND/find-usage.html

EDITORS Most popular editors available on UNIX platforms.
pico / nano
Friendly, easy to use file editor
nano /home/burst/public_html/index.html Edit the index page for the user’s website.
vi Popular editor, tons of features, harder to use at first than pico.  Check out So you want to learn VI?
vi filename.txt Edit filename.txt.
All commands in vi are preceded by pressing the escape key. Each time a different command is to be entered, the escape key needs to be used. Except where indicated, vi is case sensitive.  H — Upper left corner (home)
M — Middle line
L — Lower left corner
h — Back a character
j — Down a line
k — Up a line
^ — Beginning of line
$ — End of line
l — Forward a character
w — Forward one word
b — Back one word
fc — Find
c ; — Repeat find (find next c)
:q! — This force quits the file without saving and exits vi
:w — This writes the file to disk, saves it
:wq — This saves the file to disk and exists vi
:LINENUMBER : EG :25 — Takes you to line 25 within the file
:$ — Takes you to the last line of the file
:0 — Takes you to the first line of the file
emacs Another popular editor. For more commands go to http://www.hsrl.rutgers.edu/ug/emacs_qref.html C-\ t — Tutorial suggested for new emacs users. C-x C-c exit emacs
emacs filename.txt Edit filename.txt.
While you’re in emacs, use the following quickies to get around:
C-x C-f — read a file into emacs
C-x C-s — save a file back to disk
C-x i — insert contents of another file into this buffer
C-x C-v — replace this file with the contents of file you want
C-x C-w — write buffer to specified file
C-f — move forward one character
C-b — move backward one character
C-n — move to next line
C-p — move to previous line
C-a — move to beginning of line
C-e — move to end of line
M-f — move forward one word
M-b — move backword one word
C-v — move forward one screen
M-v — move backward one screen
M-< — go to beginning of file
M-> — go to end of file
sed ‘s/Today/Yesterday/g’ infile > outfile Replace all occurance of ‘Today’ with ‘Yesterday’.  Yes days go by so quickly.  Today is already yesterday.  Heck it maybe a few years ago since I’ve written this.
cat file | awk '{NR >=5 && NR <= 10 }' Print out each line between 5 and 10.
NETWORK Some of the basic networking utilities.
w Shows who is currently logged in and where they are logged in from.
who This also shows who is on the server in an shell.
netstat Shows all current network connections.
netstat -an Shows all connections to the server, the source and destination ips and ports.
netstat -rn Shows routing table for all ips bound to the server.
netstat -an |grep :80 |wc -l Show how many active connections there are to apache (httpd runs on port 80)
netstat -lnp Display all open ports with service name.
top Shows live system processes in a formatted table, memory information, uptime and other useful info. While in top, Shift + M to sort by memory usage or Shift + P to sort by CPU usage
top -u root Show processes running by user root only.
route -n Shows routing table for all ips bound to the server.
nslookup yahoo.com Query your default domain name server (DNS) for an Internet name (or IP number) host_to_find.
traceroute yahoo.com Have a look how you messages travel to yahoo.com
ifconfig Display info on the network interfaces.
ifconfig -a Display into on all network interfaces on server, active or inactive..
ping Sends test packets to a specified server to check if it is responding properly
tcpdump Print all the network traffic going through the network.
arp Command mostly used for checking existing Ethernet connectivity and IP address
SYSTEM TOOLS Many of the basic system utilities used to get things done.
ps ps is short for process status, which is similar to the top command. It’s used to show currently running processes and their PID. A process ID is a unique number that identifies a process, with that you can kill or terminate a running program on your server (see kill command).
ps U username Shows processes for a certain user
ps aux Shows all system processes
ps aux –forest Shows all system processes like the above but organizes in a hierarchy that’s very useful!
kill terminate a system process
kill -9 PID Immediately kill process ID
killall program_name Kill program(s) by name. For example to kill instances of httpd, do ‘killall httpd’
du Shows disk usage.
du -sh Shows a summary of total disk space used in the current directory, including subdirectories.
du / -bh | more Print detailed disk usage for each subdirectory starting at the “/”.
last Shows who logged in and when
last -20 Shows only the last 20 logins
last -20 -a Shows last 20 logins, with the hostname in the last field
pwd Print working directory, i.e., display the name of my current directory on the screen.
hostname Print the name of the local host. Use netconf (as root) to change the name of the machine.
whoami Print my login name.
date Print or change the operating system date and time
time Determine the amount of time that it takes for a process to complete + other info.
uptime Show the number days server has been up including system load averages.
uname -a Displays info on about your server such as kernel version.
free Memory info (in kilobytes).
lsmod Show the kernel modules currently loaded. Run as root.
dmesg | less Print kernel messages.
man topic Display the contents of the system manual pages (help) on the topic. Do ‘man netstat’ to find all details of netstat command including options and examples.
man -k ssh Search all man pages for keyword ‘ssh’
reboot / halt Halt or reboot the machine.
mount Mount local drive or remote file system.
mount -t auto /dev/fd0 /mnt/floppy Mount the floppy. The directory /mnt/floppy must exist.
mount -t auto /dev/cdrom /mnt/cdrom Mount the CD. The directory /mnt/cdrom must exist.
lsof +D /nfs/mount Return process id of all tasks currently utilizing /nfs/mount directory.  Useful when you’re stuck trying to unmount an NFS mount.
lsof -p <pid> See EVERYTHING that process is doing.  What files are opened, what port it’s listening to and etc.
cat /proc/cpuinfo Display cpu details such as make, model etc.
sudo The super-user do command that allows you to run specific commands that require root access.
fsck Check a disk for errors
COMPRESSION UTILITIES There are many other compression utilities but these are the default and most widely utilized.
tar Creating and Extracting .tar.gz and .tar files
tar -zxvf file.tar.gz Extracts the file
tar -xvf file.tar Extracts the file
tar -cf archive.tar contents/ Takes everything from contents/ and puts it into archive.tar
gzip -d filename.gz gzip -d filename.gz
zip Compress files into.zip
unzip file.zip Extracting .zip files shell command
compress Compress files. compress filename
uncompress Uncompress compressed files. uncompress filename.Z
bzip2 Compress files in bzip2 format
THE (DOT) FILES The good old dot files. Let’s clear up some confusion here by defining each.
.bash_login Treated by bash like .bash_profileif that doesn’t exist.
.bash_logout Sourced by bash login shells at exit.
.bash_profile Sourced by bash login shells after /etc/profile
.bash_history The list of commands executed previously.
.profile Treated by bash like ~/.bash_profile if that and .bash_login don’t exist.
.vimrc Default “Vim” configuration file.
.emacs Read by emacs at startup
CONFIGURATION FILES Listing everything is beyond the scope of this article.
/etc This directory contains most of the basic Linux system-configuration Files.
/etc/init.d Contains the permanent copies of System V–style run-level scripts. These scripts are often linked to files in the /etc/rc?.d directories to have each service associated with a script started or stopped for the particular run level. The ? is replaced by the run-level number (0 through 6). (Slackware puts its run-level scripts in the /etc/rc.d directory.)
/etc/cron* Directories in this set contain files that define how the crond utility runs applications on a daily (cron.daily), hourly (cron.hourly), monthly (cron.monthly), or weekly (cron.weekly) schedule.
/etc/cups Contains files used to configure the CUPS printing service.
/etc/default Contains files that set default values for various utilities. For example, the file for the useradd command defines the default group number, home directory, password expiration date, shell, and skeleton directory
/etc/skel Any files contained in this directory are automatically copied to a user’s home directory when that user is added to the system.
/etc/mail Contains files used to configure your sendmail mail service.
/etc/security Contains files that set a variety of default security conditions for your computer.
/etc/sysconfig Contains important system configuration files that are created and maintained by various services (including iptables, samba, and most networking services).
/etc/passwd Holds some user account info including passwords (when not “shadowed”).
/etc/shadow Contains the encrypted password information for users’ accounts and optionally the password aging information.
/etc/xinetd.d Contains a set of files, each of which defines a network service that the xinetd daemon listens for on a particular port.
/etc/syslogd.conf The configuration file for the syslogd daemon. syslogd is the daemon that takes care of logging (writing to disk) messages coming from other programs to the system.
/var Contains variable data like system logging files, mail and printer spool directories, and transient and temporary files.
/var/log Log files from the system and various programs/services, especially login (/var/log/wtmp, which logs all logins and logouts into the system) and syslog (/var/log/messages, where all kernel and system program message are usually stored).
/var/log/messages System logs. The first place you should look at if your system is in trouble.
/var/log/utmp Active user sessions. This is a data file and as such it can not be viewed normally.
/var/log/wtmp Log of all users who have logged into and out of the system. The last command can be used to access a human readable form of this file.
Apache Shell Commands Some of the basic and helpful apache commands.
httpd -v Outputs the build date and version of the Apache server.
httpd -l Lists compiled in Apache modules
httpd status Only works if mod_status is enabled and shows a page of active connections
service httpd restart Restarted Apache web server
ab -n 20 -c 2 http://www.mynitor.com/ Send 20 requests with concurrency of 2 to server mynitor.com.  Apache benchmark is pretty useful tool for load testing.  Check out 25 free tools to measure website performance.
httpd -k start -c "DocumentRoot /docs/html Start Apache with alternative docroot. Useful for debugging.
httpd -k start -f conf/httpd.conf Start Apache with different config file.
httpd -X Run Apache in debug mode.  This’ll start only one process on which you can use lsof/strace and whatever else to figure out issues.
MySQL Shell Commands Some of the basic and helpful MySQL commands.
mysqladmin processlist Shows active mysql connections and queries
mysqladmin processlist |wc -l Show how many current open connections there are to mysql
mysqladmin drop database Drops/deletes the selected database
mysqladmin create database Creates a mysql database
mysql -u username -p password databasename < data.sql Restores a MySQL database from data.sql
mysqldump -u username -p password database > data.sql Backup MySQL database to data.sql
echo “show databases” | mysql -u root -p password|grep -v Database Show all databases in MySQL server.
mysqldump -u root -p password database > /tmp/database.exp Dump database including all data and structure into /tmp/database.exp
mysqlcheck -u <user> -p<pass> -o <database_name> Optimize all tables in database.
mysql -u root -pmypass -e STATUS | grep -i uptime Check mysql uptime.
Categories: linux Tags: , , ,