Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It is absolutely possible (and indeed probable) that serving up large static resources could slow down your server. You have to have Apache worker threads open the entire time that each one of these pieces of content are being downloaded. The larger the file, the longer the download, and the longer you have to hold a thread open. You might be reaching your max threads limits before reaching any sort of memory limitations you have set for Apache.</p> <p>First, I would recommend getting all of your static content off of your server and into Cloudfront or similar CDN. This will make it to where your web server will only have to worry about the primary web requests. This might take the requests per second (and related number of open Apache threads) down from 10 request/second to like .3 requests/second (based on your 30:1 ratio of primary requests to secondary content requests).</p> <p>Reducing the number of requests you are serving by over an order of magnitude will certainly help server performance and possibly allow you to reduce down to a single server (or if you still want multiple servers - which is a good idea) possibly reduce the size of your servers.</p> <p>One thing you will find that basically all high volume websites have in common is that they leave the business of serving up static content to a CDN. Once you get to the point of being a high volume site, you must absolutely consider this (or at least serve static content from different servers using Nginx, Lighty, or some other web server better suited for serving static content than Apache is).</p> <p>After offloading your static traffic, then you can really start with worrying about tuning your web servers to handle the primary requests. When you get to that point, you will need to know a few things:</p> <ul> <li>The average memory usage for a single request thread</li> <li>The amount of memory that you have allocated to Apache (maybe 70-80% of overall instance memory if this is dedicated Apache server)</li> <li>The average amount of time it takes your application to respond to requests</li> </ul> <p>Based on that, it is a pretty simple formula to make a good starting point for tuning your max thread settings.</p> <p>Say you had the following:</p> <pre><code>Apache memory: 4000KB Avg. thread memory: 20KB Avg. time per request: 0.5 s </code></pre> <p>That means your configuration could handle request throughput as follows:</p> <pre><code>100 requests/second = 4000kb / (20kb * 0.5 seconds/request ) </code></pre> <p>Since each request averages 0.5s, you could assume that you would need 50 threads to handle this throughput.</p> <p>Obviously, you would want to set you max threads higher then 50 to account for request spikes and such, but at least this gives you a good place to start.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload