Improving Performance


ProxyIOBufferSize 1024000


Reverse proxies can also be useful when you have complex, overloaded web and application servers. Slow clients over modem lines, buggy browsers, and big multimedia files can tie up valuable resources in the servers creating the content. If a client requests a big static file and downloads it slowly, an Apache child process or thread will be busy serving it until the download completes. A similar scenario occurs when some buggy TCP/IP implementations fail to properly close a connection to the server after the transmission has finished. This is called the "lingering close" problem and will cause resources to be tied up until the connection is closed because of a timeout. While these issues are hardly avoidable, the real problem occurs when you are using process-based MPMs (such as the prefork MPM). For example, if you are running mod_perl in Apache 1.3 with multiple other Perl modules loaded and some cached data, the resulting Apache children will likely be several megabytes in size. Whenever one of them is "wasting time" serving static files or waiting for a connection to close, there are less system resources available to serve the remaining requests. A reverse proxy can help here. You can have one or several threaded, lightweight Apache frontends serving your static content and taking care of slow and buggy clients and backend, full-featured, servers doing the dynamic content generation. You can tune ProxyIOBufferSize so big files are transferred to the reverse proxy quickly and the connection to the backend server is freed as soon as possible. This reduces the load on the backend server, though it increases the memory consumption in the proxy machine. Recent MPMs in Apache 2.1 allow the same Apache child to manage multiple connections, including having a dedicated thread whose task is to wait for connections to close. These MPMs, as they mature, will allow Apache to scale much better in a number of situations.




Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net