gfgrep-status: /etc/grep-dctrl.rc: write permissions for group or others, ignoring Error , Solved

 

godaddy servers mysql configuration file my.cnf

Variable Wert für diese Sitzung / Globaler Wert

 

how to Configure and TEST Apache for Maximum Performance

 Tested , By Kutay ZORLU  ,,

Apache is an open-source HTTP server implementation. It is the most popular web server on the Internet; the December 2005 Web Server Survey conducted by Netcraft [1] shows that about 70% of the web sites on Internet are using Apache.

Apache server performance can be improved by adding additional hardware resources such as RAM, faster CPU, etc. But most of the time, the same result can be achieved by custom configuration of the server. This article looks into getting maximum performance out of Apache with the existing hardware resources, specifically on Linux systems. Of course, it is assumed that there is enough hardware resources – especially enough RAM that the server isn’t swapping frequently. First two sections look into various Compile-Time and Run-Time configuration options. The Run-Time section assumes that Apache is compiled with prefork MPM. HTTP compression and caching is discussed next. Finally, using separate servers for serving static and dynamic contents is covered. Basic knowledge of compiling and configuring Apache and Linux are assumed.

2 Compile-Time Configuration Options

2.1 Load only the required modules:

The Apache HTTP Server is a modular program where the administrator can choose the functions to be included in the server by selecting a set of modules [2]. The modules can be compiled either statically as part of the ‘httpd’ binary, or as Dynamic Shared Objects (DSOs). DSO modules can either be compiled when the server is built, or added later via the apxs utility, which allows compilation at a later date. The mod_so module must be statically compiled into the Apache core to enable DSO support.

Run Apache with only the required modules. This reduces the memory footprint, which improves the server performance. Statically compiling modules will save RAM that’s used for supporting dynamically loaded modules, but you would have to recompile Apache to add or remove a module. This is where the DSO mechanism comes handy. Once the mod_so module is statically compiled, any other module can be added or dropped using the ‘LoadModule’ command in the ‘httpd.conf’ file. Of course, you will have to compile the modules using ‘apxs’ if they weren’t compiled when the server was built.

2.2 Choose appropriate MPM:

The Apache server ships with a selection of Multi-Processing Modules (MPMs) which are responsible for binding to network ports on the machine, accepting requests, and dispatching children to handle the requests [3]. Only one MPM can be loaded into the server at any time.

Choosing an MPM depends on various factors, such as whether the OS supports threads, how much memory is available, scalability versus stability, whether non-thread-safe third-party modules are used, etc.

Linux systems can choose to use a threaded MPM like worker or a non-threaded MPM like prefork:

The worker MPM uses multiple child processes. It’s multi-threaded within each child, and each thread handles a single connection. Worker is fast and highly scalable and the memory footprint is comparatively low. It’s well suited for multiple processors. On the other hand, worker is less tolerant of faulty modules, and a faulty thread can affect all the threads in a child process.

The prefork MPM uses multiple child processes, each child handles one connection at a time. Prefork is well suited for single or double CPU systems, speed is comparable to that of worker, and it’s highly tolerant of faulty modules and crashing children – but the memory usage is high, and more traffic leads to greater memory usage.

3 Run-Time Configuration Options

3.1 DNS lookup:

The HostnameLookups directive enables DNS lookup so that hostnames can be logged instead of the IP address. This adds latency to every request since the DNS lookup has to be completed before the request is finished. HostnameLookups is Off by default in Apache 1.3 and above. Leave it Off and use post-processing program such as logresolve to resolve IP addresses in Apache’s access logfiles. Logresolve ships with Apache.

When using ‘Allow from’ or ‘Deny from’ directives, use an IP address instead of a domain name or a hostname. Otherwise, a double DNS lookup is performed to make sure that the domain name or the hostname is not being spoofed.

3.2 AllowOverride:

If AllowOverride is not set to ‘None’, then Apache will attempt to open the .htaccess file (as specified by AccessFileName directive) in each directory that it visits. For example:

If a request is made for URI /index.html, then Apache will attempt to open /.htaccess, /var/.htaccess, /var/www/.htaccess, and /var/www/html/.htaccess. These additional file system lookups add to the latency. If .htaccess is required for a particular directory, then enable it for that directory alone.

3.3 FollowSymLinks and SymLinksIfOwnerMatch:

If FollowSymLinks option is set, then the server will follow symbolic links in this directory. If SymLinksIfOwnerMatch is set, then the server will follow symbolic links only if the target file or directory is owned by the same user as the link.

If SymLinksIfOwnerMatch is set, then Apache will have to issue additional system calls to verify whether the ownership of the link and the target file match. Additional system calls are also needed when FollowSymLinks is NOT set.
For example:

For a request made for URI /index.html, Apache will perform lstat() on /var, /var/www, /var/www/html, and /var/www/html/index.html. These additional system calls will add to the latency. The lstat results are not cached, so they will occur on every request.

For maximum performance, set FollowSymLinks everywhere and never set SymLinksIfOwnerMatch. Or else, if SymLinksIfOwnerMatch is required for a directory, then set it for that directory alone.

3.4 Content Negotiation:

Avoid content negotiation for fast response. If content negotiation is required for the site, use type-map files rather than Options MultiViews directive. With MultiViews, Apache has to scan the directory for files, which adds to the latency.

3.5 MaxClients:

The MaxClients sets the limit on maximum simultaneous requests that can be supported by the server; no more than this number of child processes are spawned. It shouldn’t be set too low; otherwise, an ever-increasing number of connections are deferred to the queue and eventually time-out while the server resources are left unused. Setting this too high, on the other hand, will cause the server to start swapping which will cause the response time to degrade drastically. The appropriate value for MaxClients can be calculated as:

[4] MaxClients = Total RAM dedicated to the web server / Max child process size

The child process size for serving static file is about 2-3M. For dynamic content such as PHP, it may be around 15M. The RSS column
in “ps -ylC httpd --sort:rss” shows non-swapped physical memory usage by Apache processes in kiloBytes.

If there are more concurrent users than MaxClients, the requests will be queued up to a number based on ListenBacklog directive. Increase ServerLimit to set MaxClients above 256.

3.6 MinSpareServers, MaxSpareServers, and StartServers:

MaxSpareServers and MinSpareServers determine how many child processes to keep active while waiting for requests. If the MinSpareServers is too low and a bunch of requests come in, Apache will have to spawn additional child processes to serve the requests. Creating child processes is relatively expensive. If the server is busy creating child processes, it won’t be able to serve the client requests immediately. MaxSpareServers shouldn’t be set too high: too many child processes will consume resources unnecessarily.

Tune MinSpareServers and MaxSpareServers so that Apache need not spawn more than 4 child processes per second (Apache can spawn a maximum of 32 child processes per second). When more than 4 children are spawned per second, a message will be logged in the ErrorLog.

The StartServers directive sets the number of child server processes created on startup. Apache will continue creating child processes until the MinSpareServers setting is reached. This doesn’t have much effect on performance if the server isn’t restarted frequently. If there are lot of requests and Apache is restarted frequently, set this to a relatively high value.

3.7 MaxRequestsPerChild:

The MaxRequestsPerChild directive sets the limit on the number of requests that an individual child server process will handle. After MaxRequestsPerChild requests, the child process will die. It’s set to 0 by default, the child process will never expire. It is appropriate to set this to a value of few thousands. This can help prevent memory leakage, since the process dies after serving a certain number of requests. Don’t set this too low, since creating new processes does have overhead.

3.8 KeepAlive and KeepAliveTimeout:

The KeepAlive directive allows multiple requests to be sent over the same TCP connection. This is particularly useful while serving HTML pages with lot of images. If KeepAlive is set to Off, then for each images, a separate TCP connection has to be made. Overhead due to establishing TCP connection can be eliminated by turning On KeepAlive.

KeepAliveTimeout determines how long to wait for the next request. Set this to a low value, perhaps between two to five seconds. If it is set too high, child processed are tied up waiting for the client when they could be used for serving new clients.

4 HTTP Compression & Caching

HTTP compression is completely specified in HTTP/1.1. The server uses either the gzip or the deflate encoding method to the response payload before it is sent to the client. Client then decompresses the payload. There is no need to install any additional software on the client side since all major browsers support these methods. Using compression will save bandwidth and improve response time; studies have found a mean gain of %75.2 when using compression [5].

HTTP Compression can be enabled in Apache using the mod_deflate module. Payload is compressed only if the browser requests compression, otherwise uncompressed content is served. A compression-aware browser inform the server that it prefer compressed content through the HTTP request header – “Accept-Encoding: gzip,deflate“. Then the server responds with compressed payload and the response header set to “Content-Encoding: gzip“.

The following example uses telnet to view request and response headers:

In caching, a copy of the data is stored at the client or in a proxy server so that it need not be retrieved frequently from the server. This will save bandwidth, decrease load on the server, and reduce latency. Cache control is done through HTTP headers. In Apache, this can be accomplished through mod_expires and mod_headersmodules. There is also server side caching, in which the most frequently-accessed content is stored in memory so that it can be served fast. The module mod_cache can be used for server side caching; it is production stable in Apache version 2.2.

5 Separate server for static and dynamic content

Apache processes serving dynamic content take from 3MB to 20MB of RAM. The size grows to accommodate the content being served and never decreases until the process dies. As an example, let’s say an Apache process grows to 20MB while serving some dynamic content. After completing the request, it is free to serve any other request. If a request for an image comes in, then this 20MB process is serving static content – which could be served just as well by a 1MB process. As a result, memory is used inefficiently.

Use a tiny Apache (with minimum modules statically compiled) as the front-end server to serve static contents. Requests for dynamic content should be forwarded to the heavy-duty Apache (compiled with all required modules). Using a light front-end server has the advantage that the static contents are served fast without much memory usage and only the dynamic contents are passed over to the big server.

Request forwarding can be achieved by using mod_proxy and mod_rewrite modules. Suppose there is a lightweight Apache server listening to port 80 and a heavyweight Apache listening on port 8088. Then the following configuration in the lightweight Apache can be used to forward all requests (except requests for images) to the heavyweight server:
[9]

All requests, except for images, will be proxied to the backend server. The response is received by the frontend server and supplied to the client. As far as client is concerned, all the responses seem to come from a single server.

6 Conclusion

Configuring Apache for maximum performance is tricky; there are no hard and fast rules. Much depends on understanding the web server requirements and experimenting with various available options. Use tools like ab and httperf to measure the web server performance. Lightweight servers such as tux or thttpd can also be used as the front-end server. If a database server is used, make sure it is optimized so that it won’t create any bottlenecks. In case of MySQL, mtop can be used to monitor slow queries. Performance of PHP scripts can be improved by using a PHP caching product such as Turck MMCache. It eliminates overhead due to compiling by caching the PHP scripts in a compiled state.

How do I improve my server disk performance

 

From http://www.ubuntu.com 

server runs rsnapshot multiple times a day to backup remote hosts. The actual incremental backup part takes very little time. The significant time is spent doing things like:-

/bin/cp -al /srv/rsnapshot/hourly.0 /srv/rsnapshot/hourly.1 

Which takes about 2 hours. I realise there are a bazillion tiny files in there.

Also when rsnapshot deletes an old backup this can take a long time:-

/bin/rm -rf /srv/rsnapshot/daily.6/

Which takes about half an hour.

My questions are as follows, configuration of server and some IO stats are detailed below. I can of course provide more debug info if necessary:-

How can I identify where the bottlenecks are?

Am I reaching the limits of what’s capable (IO wise) with this box?

Are there any performance tweaks I could make?

Should I use a different RAID level?

Would it make sense to swap two of the internal RAID disks (half of each mirror) with two ‘other halves of the other mirror’ on the external array?

Note: I’m somewhat not inclined to be doing things like compiling my own kernel. Ideally I’d like to stick on 10.04 LTS, unless there’s some magic in later versions that makes this all work a lot quicker.

Internally the server has 1x160GB SATA boot disk and 4x2TB disks:-

The four internal 2TB disks are in a software MD RAID10 setup:-

ubuntu how to install java

This tutorial will cover the installation of

These instructions will also work on Debian and Linux Mint.

Check to see if your Ubuntu Linux operating system architecture is 32-bit or 64-bit, open up a terminal and run the following command below.

Java Version

If you have OpenJDK installed on your system it may look like this

If you have OpenJDK installed on your system, you have the wrong vendor version of Java installed for this exercise.
Completely remove the OpenJDK/JRE from the system if necessary
This will prevent system conflicts and confusion between different vendor versions of Java. For example, if you have the OpenJDK/JRE installed on your system, you can remove it by typing the following at the command line:

This command will completely remove OpenJDK/JRE from your system
Create a directory to put your Oracle Java JDK and JRE binaries in, open up a terminal and create the directory /usr/local/java

Download the Oracle Java JDK/JRE for Linux. Make sure you select the correctcompressed binaries for your system architecture 32-bit or 64-bit (which end in tar.gz).

For example, if you are on Ubuntu Linux 32-bit operating system download 32-bit Oracle Java binaries.
For example, if you are on Ubuntu Linux 64-bit operating system download 64-bit Oracle Java binaries.

Copy the Oracle Java binaries into the /usr/local/java directory
In most cases, the Oracle Java binaries are downloaded to: /home/“your_user_name”/Downloads.

32-bit Oracle Java on 32-bit Ubuntu Linux installation instructions:

Run the following commands on the downloaded Oracle Java tar.gz files. Make sure to do this as root in order to make them executable for all users on your system.
32-bit Oracle Java on 32-bit Ubuntu Linux installation instructions:

Unpack the compressed Java binaries, in the directory /usr/local/java

64-bit Oracle Java on 64-bit Ubuntu Linux installation instructions:

Double-check your directories. At this point, you should have two uncompressed binary directories in /usr/local/java for the Java JDK/JRE listed as:

Inform your Ubuntu Linux system where your Oracle Java JDK/JRE is located. This will tell the system that the new Oracle Java version is available for use.this command notifies the system that Oracle Java JRE is available for use

this command notifies the system that Oracle Java JDK is available for use

this command notifies the system that Oracle Java Web start is available for use,
Inform your Ubuntu Linux system that Oracle Java JDK/JRE must be the default Java

Note your system-wide PATH /etc/profile file will reload after reboot of your Ubuntu Linux system.
Test to see if Oracle Java was installed correctly on your system. Run the following commands and note the version of Java:

This command displays the version of java running on your system
A successful installation of 32-bit Oracle Java will display

You should receive a message which displays:

This command lets you know that you are now able to compile Java programs from the terminal.
You should receive a message which displays:
javac 1.7.0_05
A successful installation of Oracle Java 64-bit will display
java -version
This command displays the version of java running on your system
You should receive a message which displays:

 Congratulations, you just installed Oracle Java on your Linux system.

Now reboot your Ubuntu Linux system.
Afterwards, your system will be fully configured for running and developing Java programs.

Ways To Search For Files Using The Terminal

Today we will look at some of the common ways to search for files in Linux using the Terminal.

1) find : To search for files on the command line you can use the command “find”. The following is syntax for the “find” command:

find path criteria action

“path” – The section of the files system to search (the specific directories and all the sub directories). If nothing is specified the file system below the current directory is used.

“criteria” – The file properties.

“action” – Options that influence conditions or control the search as a whole, ie,
“–print”

 

 

2007-11-22-153941_1280x800_scrot

 

2) locate : The command “locate” is an alternative to the command “find -name”. The command find must search through the selected part of the file system, a process that can be quite slow. On the other hand, locate searches through a database previously created for this purpose (/var/lib/locatedb), making it much faster. The database is automatically created and updated daily. But change made after the update has been performed are not taken into account by locate, unless the database is updated manually using the command updatedb.

 

2007-11-22-154054_1280x800_scrot

 

3) whereis : The command “whereis” returns the binaries (option -b), manual pages (option -m), and the source code (option -s) of the specific command. If no options is used all the information is returned, if the information is available. This command is faster than “find” but is less thorough.

2007-11-22-154226_1280x800_scrot

 

4) which : The “which” command searches all paths listed in the variable PATH for the specific command and returns the full path of the command. the command is specifically useful if several version of a command exist in different directories and you want to know which version is executed when entered without specifying a path.

2007-11-22-154254_1280x800_scrot

 

5) type : The “type” command can be used to find out what kind of command is executed when command is entered – a shell built in command or an external command. The option -a delivers all instances of a command bearing this name in the file system.

2007-11-22-154354_1280x800_scrot

great programs for terminal linux

cmus
cmus is a music player that I admire the most when it comes to command-line because it’s really powerful and has a lot of nice features. It is built with ncurses and therefore providing a text-user interface. cmus is indeed feature-rich, with several view modes and Last.fm song submission support via scripts. It supports Vi-like commands and auto-completion with Tab too. Recently I wrote a full guide on how to use cmus, you can read it here.
Homepage


finch
Finch comes bundled with Pidgin, the popular IM client. Finch offers the same functionality that Pidgin offers, only that it does it in a terminal by using the ncurses library. It supports IM protocols like Yahoo, Google Talk, XMPP (Facebook), WLM (Windows Live Messenger) and more. A while ago I put up a detailed guide to Finch, which you can read here.
Homepage

htop
htop is an interactive process viewer tool using ncurses which has the great benefit that it allows to scroll up and down the list of processes, and it also uses graphs and colors. I think all these make htop a real gem for the Linux user.
Homepage

irssi
Very powerful IRC (Internet Relay Chat) client with an ncurses-based interface, implements multi-server support, can be expanded with Perl scripts, supports themes, DCC chat and every other possible feature IRC servers allow.
Homepage

mc
Midnight Commander is the famous twin-panel file manager for the Linux terminal, also based on ncurses and with lots of features.
Homepage

lynx
lynx is a popular web browser for the terminal. It supports protocols like HTTP, FTP or Gopher.
Homepage

gzip
gzip is a command-line tool for compressing and uncompressing files. All the files that end in a .tar.gz extension are archived with tar and compressed with gzip.
Homepage

bzip2
Same as gzip, bzip2 is a data compressor which takes a longer time to compress and uncompress files, but it also provides a more efficient compression algorithm which results in smaller files.
Homepage

tar
This tool is used to create archived files, and will also work in conjunction with gzip or bzip2. The command to compress a file or folder to gzip is (what follows after # is a comment):

The c argument means compress, the z specifies the type of file to create (gzip file in this case), and f specifies the output file name. The command to uncompress a .tar.gz file:

This will extract the contents of input_file.tar.gz to the current working directory. Here are the commands for bzip2:

Homepage

aaxine
aaxine is a video player for console based on xine-lib multimedia player, using ASCII characters for video output. In Ubuntu it is provided by the xine-console package.
Homepage


…it’s Big Buck Bunny by the way

aview
This tool allows to view images as ASCII art. It only supports the following formats, which are either in binary form or ASCII plain text: PNM, PGM, PBM, PPM. It also supports FLI and FLC video formats.
Homepage

mencoder
mencoder is a powerful video encoder and decoder included in MPlayer and can convert between various video files.
Homepage

ffmpeg
Using libavcodec, ffmpeg is yet another powerful tool to encode/decode, record and stream video files.
Homepage

convert
Included in ImageMagick, convert is a tool that can convert between image formats, and also apply various effects to images or edit certain aspects, including resizing, cropping, blur or dither effects. convert is also used on web servers for image processing.
Homepage

moc
moc (music on console) is yet another ncurses-based music player for the terminal which plays formats like Ogg Vorbis, FLAC, MP3, WAV or WMA. It also supports themes and searching for files.
Homepage