Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Say that I have a PHP site running on that hosts larger images. Each page is very simple and takes virtually no time to process in PHP, but it might contain couple MB large image.

The question is, if I have Apache set up to handle 100 connections, and the page itself takes couple ms to generate, does it keep the connection blocked for the image transfer, or is this handled on some other connection pool?

Because in the first case, it might take couple seconds to download the image, so I would be able to serve only 100 clients at a time.

share|improve this question
    
To improve the performance, you can increase the connection count limit if your hardware can process all the connections. Otherwise, you may need to upgrade your server or add more servers. –  Khaled Dec 1 '10 at 15:07
add comment

2 Answers

up vote 2 down vote accepted

Every connection to the server whether PHP or static file serving are from the same 100 connection pool. Once PHP serves up the HTML the connection is free to be used for something else. If it's a persistent connection then it will probably be re-used to download an image.

Keep in mind that modern browsers will create at least 2 to 6 persistent connections so it'll be less than 100 clients at a time.

Example scenario assuming KeepAlive is on: One connection handles the PHP script then that same connection will start downloading an image and the browser opens or uses existing connections to download the other images.

share|improve this answer
add comment

It depends on the keepalive setting. If you set it to 'on' connections are reused. If you set it to 'off' new connections are made for every page element (html/php,image,javascript files, css etc). Keeping it on means a better experience for your users at the expense of server CPU load. Keeping it off means a slower browsing experience but server load is slightly reduced. Also you can tune the keepalivetimeout setting. Set it to 5 or less.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.