Apache web server windows requirements




















How much memory each process takes for itself depends heavily on the number and kind of modules you use. The best approach to use in determining this need is to generate a typical test load against your web site and see how large the httpd processes become. The RAM for external programs parameter is intended mostly for CGI programs and scripts that run outside the web server process.

However, if you have a Java virtual machine running Tomcat on the same box it will need a significant amount of memory as well. The above assessment should give you an idea how far you can push MaxClients ,but it is not an exact science. When in doubt, be conservative and use a low MaxClients value. The Linux kernel will put extra memory to good use for caching disk access. On Solaris you need enough available real RAM memory to create any process.

If no real memory is available, httpd will start writing 'No space left on device' messages to the error log and be unable to fork additional child processes, so a higher MaxClients value may actually be a disadvantage. The prime reason for selecting a threaded MPM is that threads consume fewer system resources than processes, and it takes less effort for the system to switch between threads.

This is more true for some operating systems than for others. On systems like Solaris and AIX, manipulating processes is relatively expensive in terms of system resources.

On these systems, running a threaded MPM makes sense. On Linux, the threading implementation actually uses one process for each thread.

Linux processes are relatively lightweight, but it means that a threaded MPM offers less of a performance advantage than in other environments. Running a threaded MPM can cause stability problems in some situations For instance, should a child process of a preforked MPM crash, at most one client connection is affected. However, if a threaded child crashes, all the threads in that process disappear, which means all the clients currently being served by that process will see their connection aborted.

Additionally, there may be so-called "thread-safety" issues, especially with third-party libraries. In threaded applications, threads may access the same variables indiscriminately, not knowing whether a variable may have been changed by another thread.

This has been a sore point within the PHP community. The PHP processor heavily relies on third-party libraries and cannot guarantee that all of these are thread-safe. The good news is that if you are running Apache on Linux, you can run PHP in the preforked MPM without fear of losing too much performance relative to the threaded option.

Apache httpd maintains an inter-process lock around its network listener. For all practical purposes, this means that only one httpd child process can receive a request at any given time. The other processes are either servicing requests already received or are 'camping out' on the lock, waiting for the network listener to become available.

This process is best visualized as a revolving door, with only one process allowed in the door at any time. On a heavily loaded web server with requests arriving constantly, the door spins quickly and requests are accepted at a steady rate.

On a lightly loaded web server, the process that currently "holds" the lock may have to stay in the door for a while, during which all the other processes sit idle, waiting to acquire the lock. At this time, the parent process may decide to terminate some children based on its MaxSpareServers directive. The function of the 'accept mutex' as this inter-process lock is called is to keep request reception moving along in an orderly fashion. If the lock is absent, the server may exhibit the Thundering Herd syndrome.

Consider an American Football team poised on the line of scrimmage. If the football players were Apache processes all team members would go for the ball simultaneously at the snap. One process would get it, and all the others would have to lumber back to the line for the next snap. In this metaphor, the accept mutex acts as the quarterback, delivering the connection "ball" to the appropriate player process.

Moving this much information around is obviously a lot of work, and, like a smart person, a smart web server tries to avoid it whenever possible. Hence the revolving door construction. In recent years, many operating systems, including Linux and Solaris, have put code in place to prevent the Thundering Herd syndrome. Apache recognizes this and if you run with just one network listener, meaning one virtual host or just the main server, Apache will refrain from using an accept mutex.

If you run with multiple listeners for instance because you have a virtual host serving SSL requests , it will activate the accept mutex to avoid internal conflicts.

You can manipulate the accept mutex with the AcceptMutex directive. Besides turning the accept mutex off, you can select the locking mechanism. Common locking mechanisms include fcntl, System V Semaphores and pthread locking.

Not all are available on every platform, and their availability also depends on compile-time settings. The various locking mechanisms may place specific demands on system resources: manipulate them with care. There is no compelling reason to disable the accept mutex. Apache automatically recognizes the single listener situation described above and knows if it is safe to run without mutex on your platform.

People often look for the 'magic tune-up' that will make their system perform four times as fast by tweaking just one little setting. The truth is, present-day UNIX derivatives are pretty well adjusted straight out of the box and there is not a lot that needs to be done to make them perform optimally. However, there are a few things that an administrator can do to improve performance. The usual mantra regarding RAM is "more is better".

As discussed above, unused RAM is put to good use as file system cache. A large configuration file-with many virtual hosts-also tends to inflate the process footprint.

Having ample RAM allows you to run Apache with more child processes, which allows the server to process more concurrent requests. While the various platforms treat their virtual memory in different ways, it is never a good idea to run with less disk-based swap space than RAM.

The virtual memory system is designed to provide a fallback for RAM, but when you don't have disk space available and run out of swappable memory, your machine grinds to a halt. This can crash your box, requiring a physical reboot for which your hosting facility may charge you.

Also, such an outage naturally occurs when you least want it: when the world has found your website and is beating a path to your door. If you have enough disk-based swap space available and the machine gets overloaded, it may get very, very slow as the system needs to swap memory pages to disk and back, but when the load decreases the system should recover.

Remember, you still have MaxClients to keep things in hand. Most unix-like operating systems use designated disk partitions for swap space. When adding a disk or installing the operating system, be sure to allocate enough swap space to accommodate eventual RAM upgrades. Reassigning disk space on a running system is a cumbersome process.

Plan for available hard drive swap space of at least twice your amount of RAM, perhaps up to four times in situations with frequent peaking loads. Remember to adjust this configuration whenever you upgrade RAM on your system. In a pinch, you can use a regular file as swap space. For instructions on how to do this, see the manual pages for the mkswap and swapon or swap programs.

Given a machine with plenty of RAM and processor capacity, you can run hundreds of Apache processes if necessary. Consider a situation in which several hundred web servers are running; if some of these need to spawn CGI processes, the maximum number of processes would occur quickly. This must be changed before starting the server, since the new value will only be available to the current shell and programs started from it. In newer Linux kernels the default has been raised to On FreeBSD, the number seems to be the rather unusual In the default user shell on this system, csh the equivalent is limit and works analogous to the Bourne-like ulimit :.

Similarly, the kernel may limit the number of open files per process. This is generally not a problem for pre-forked servers, which just handle one request at a time per process. Threaded servers, however, serve many requests per process and much more easily run out of available file descriptors. You can increase the maximum number of open files per process by running the. This file allows you to set soft and hard limits on a per-user or per-group basis; the file contains commentary explaining the options.

All items can have a 'soft' and a 'hard' limit: the first is the default setting and the second the maximum value for that item. These are the same tunables that can be set with the mdb kernel debugger during run time. The soft and hard limit corresponding to ulimit -u can be set via:. Solaris calculates the maximum number of allowed processes per user maxuprc based on the total amount available memory on the system maxusers. You can review the numbers with. You probably need few of them.

For example, your web server does not need to be running sendmail, nor is it likely to be an NFS server, etc. Turn them off. On Red Hat Linux, the chkconfig tool will help you do this from the command line.

On Solaris systems svcs and svcadm will show which services are enabled and disable them respectively. In a similar fashion, cast a critical eye on the Apache modules you load. Most binary distributions of Apache httpd, and pre-installed versions that come with Linux distributions, have their modules enabled through the LoadModule directive. Unused modules may be culled: if you don't rely on their functionality and configuration directives, you can turn them off by commenting out the corresponding LoadModule lines.

Read the documentation on each module's functionality before deciding whether to keep it enabled. While the performance overhead of an unused module is small, it's also unnecessary.

Requests for dynamically generated content usually take significantly more resources than requests for static content. Static content consists of simple filespages, images, etc. You may find yourself becoming overwhelmed as you start to set up Apache server. As an open source, advanced application capable of a wide range of functions, Apache web server configuration and setup is fairly complex.

With both installation options, modules can be compiled in the form of a dynamic shared object, or DSO. A DSO is an object file capable of being shared and utilized by numerous applications. DSO modules are separate from the core Apache file.

The DSO approach to compiling modules is popular because it makes adding, updating, and removing modules easy. This Apache server tutorial will now provide instructions for Apache web server configuration in Linux, step by step. Modifying configuration settings will ensure they reflect the domain specifics, which will allow Apache to respond to domain requests correctly and successfully. The process for completing virtual server Apache configuration is simple:.

After setting up Apache web server, I highly recommend the use of a monitoring tool to help you test Apache server and monitor it effectively. This tool allows you to easily define specific performance metrics to facilitate proactive monitoring of Apache Cassandra , Apache Geronimo, and Apache Tomcat. The single application is capable of monitoring and managing your entire Apache environment, and the underlying infrastructure of the server.

With SAM, monitoring uptime and performance is easy, as is diagnosing the root of performance issues. The application facilitates proactive monitoring of all web server supporting components contributing to the Apache web server, including Linux and MySQL.

You need to uninstall or disable any program that uses that port. You may have this installed already, but there is no harm installing it again. Open it with your favorite text editor. Your Apache configuration can now be tested. If not, correct any httpd. The easiest way to start Apache is to add it as a Windows service. Open a new command prompt as administrator , and enter the following:.



0コメント

  • 1000 / 1000