Apache windows 2008 performance tuning




















When using Allow from or Deny from directives, use 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. These additional file system lookups add to the latency. 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.

For example:. 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 add to the latency. 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 MaxSpareServers and MinSpareServers determine how many child processes to keep while waiting for requests.

If the MinSpareServers is too low and a bunch of requests come in, then 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, it can cause resource problems since the child processes consume resources. Tune MinSpareServers and MaxSpareServers such that Apache need not frequently spwan more than 4 child processes per second Apache can spwan 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 process until the MinSpareServers setting is reached. 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. 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. It grows to accommodate the content it's serving and never decreases until the process dies. Say an Apache process grows to 20M to serve a dynamic content. After completing the request, it is free to serve any other request. Or is it? For anyone else who searches for this, I found that uninstalling the old Apache in my case, 2.

We had locked down the httpd. Upon uninstalling and re-installing, all of these files were left unchanged and the new version of Apache Server is reflected. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. How to upgrade Apache on a Windows server? Ask Question. Asked 9 years, 11 months ago. Active 8 years, 6 months ago. Viewed 18k times. Richard Richard 4, 5 5 gold badges 30 30 silver badges 52 52 bronze badges.

Add a comment. Active Oldest Votes. If you need to have addresses in your log files resolved to hostnames, use the logresolve program that comes with Apache, or one of the numerous log reporting packages which are available. It is recommended that you do this sort of postprocessing of your log files on some machine other than the production web server machine, in order that this activity not adversely affect server performance.

If you use any Allow from domain or Deny from domain directives i. For best performance, therefore, use IP addresses, rather than names, when using these directives, if possible. In this case the DNS lookups are only performed on requests matching the criteria.

Here's an example which disables lookups except for. One extra call per filename component. For example, if you had:. The results of these lstats are never cached, so they will occur on every single request. If you really desire the symlinks security checking, you can do something like this:.

This at least avoids the extra checks for the DocumentRoot path. Note that you'll need to add similar sections if you have any Alias or RewriteRule paths outside of your document root.

Wherever in your URL-space you allow overrides typically. For example,. The solutions are similar to the previous case of Options FollowSymLinks. For highest performance use AllowOverride None everywhere in your filesystem.

If at all possible, avoid content negotiation if you're really interested in every last ounce of performance. In practice the benefits of negotiation outweigh the performance penalties.

There's one case where you can speed up the server. Instead of using a wildcard such as:. Also note that explicitly creating a type-map file provides better performance than using MultiViews , as the necessary information can be determined by reading this single file, rather than having to scan the directory for files.

If your site needs content negotiation, consider using type-map files, rather than the Options MultiViews directive to accomplish the negotiation. See the Content Negotiation documentation for a full discussion of the methods of negotiation, and instructions for creating type-map files.

In situations where Apache 2. On some platforms, this memory-mapping improves performance. However, there are cases where memory-mapping can hurt the performance or even the stability of the httpd:. On some operating systems, mmap does not scale as well as read 2 when the number of CPUs increases.

On multiprocessor Solaris servers, for example, Apache 2. If you memory-map a file located on an NFS-mounted filesystem and a process on another NFS client machine deletes or truncates the file, your process may get a bus error the next time it tries to access the mapped file content.

For installations where either of these factors applies, you should use EnableMMAP off to disable the memory-mapping of delivered files. Note: This directive can be overridden on a per-directory basis.

On most platforms, using sendfile improves performance by eliminating separate read and send mechanics. However, there are cases where using sendfile can harm the stability of the httpd:. Some platforms may have broken sendfile support that the build system did not detect, especially if the binaries were built on another box and moved to such a machine with broken sendfile support. With an NFS-mounted filesystem, the kernel may be unable to reliably serve the network file through its own cache.

For installations where either of these factors applies, you should use EnableSendfile off to disable sendfile delivery of file contents.

In particular, Apache required a "ramp-up" period in order to reach a number of children sufficient to serve the load being applied. After the initial spawning of StartServers children, only one child per second would be created to satisfy the MinSpareServers setting.

So a server being accessed by simultaneous clients, using the default StartServers of 5 would take on the order of 95 seconds to spawn enough children to handle the load.

This works fine in practice on real-life servers because they aren't restarted frequently. But it does really poorly on benchmarks which might only run for ten minutes. The one-per-second rule was implemented in an effort to avoid swamping the machine with the startup of new children. If the machine is busy spawning children, it can't service requests.

But it has such a drastic effect on the perceived performance of Apache that it had to be replaced. As of Apache 1. It will spawn one, wait a second, then spawn two, wait a second, then spawn four, and it will continue exponentially until it is spawning 32 children per second. It will stop whenever it satisfies the MinSpareServers setting. When more than 4 children are spawned per second, a message will be emitted to the ErrorLog. If you see a lot of these errors, then consider tuning these settings.

Related to process creation is process death induced by the MaxConnectionsPerChild setting. By default this is 0 , which means that there is no limit to the number of connections handled per child.

If your configuration currently has this set to some very low number, such as 30 , you may want to bump this up significantly. If you are running SunOS or an old version of Solaris, limit this to or so because of memory leaks.

When keep-alives are in use, children will be kept busy doing nothing waiting for more requests on the already open connection. The default KeepAliveTimeout of 5 seconds attempts to minimize this effect. The tradeoff here is between network bandwidth and server resources. In no event should you raise this above about 60 seconds, as most of the benefits are lost. When building Apache, you must choose an MPM to use.

For general Unix-type systems, there are several MPMs from which to choose. The choice of MPM can affect the speed and scalability of the httpd:. Since memory usage is such an important consideration in performance, you should attempt to eliminate modules that you are not actually using.

If you have built the modules as DSOs , eliminating modules is a simple matter of commenting out the associated LoadModule directive for that module. This allows you to experiment with removing modules and seeing if your site still functions in their absence.

If, on the other hand, you have modules statically linked into your Apache binary, you will need to recompile Apache in order to remove unwanted modules. An associated question that arises here is, of course, what modules you need, and which ones you don't.

The answer here will, of course, vary from one web site to another. This is, however, not recommended. This API provides atomic operations that can be used for lightweight thread synchronization.

On some platforms, however, APR defaults to a slower, mutex-based implementation of the atomic API in order to ensure compatibility with older CPU models that lack such instructions. If you are building Apache for one of these platforms, and you plan to run only on newer CPUs, you can select a faster atomic implementation at build time by configuring Apache with the --enable-nonportable-atomics option:.

The --enable-nonportable-atomics option is relevant for the following platforms:. This is all done so that the status report contains timing indications.



0コメント

  • 1000 / 1000