On Sat, Nov 22, 2008 at 10:14 PM, Micah Stevens <[EMAIL PROTECTED]>wrote:
> On 11/22/2008 04:30 PM, Jujitsu Lizard wrote: > > Summary: (a) Both approaches are quite good, and (b) the CPU efficiency > > argument for stuffing prepared images into a table or similar may be > weak. > > > > The Lizard > > > > > By using pre-drawn images and HTML img tag calls you distribute the > processing to the client side, by doing this is certainly reduces > overhead because you're sending text thereby eliminating ANY overhead at > all. I think this almost by definition would suggest a significantly > lower overhead. > > Granted in a one shot call, the difference will be minuscule, in a > production web server environment with many client calls, you want to > distribute this as much as possible to reduce server overhead and I > think anyone here that has done GD processing in a production > environment will tell you, using it isn't free by any stretch of the > imagination. > > -Micah Well, if you want to get into detail ... The approach you suggested requires the client to fetch a small number of different static images (maybe 5) from the web server. I've gotta assume that there won't be more GETs, as the web browser should be smart enough to know that images with the same path and with no contraindications (header nocache info) don't require a separate fetch. For each of those HTTP requests for the image, the web server has to process the request, which includes opening the TCP connection, parsing the request, double-checking permissions and paths, etc., delivering the data, and closing the TCP connection. I'm sure Apache is very efficient at that stuff, but I'd be left with the question of whether processing multiple requests for static images costs less or more than generating a single dynamic image. Using the example of 5 static images, you'd potentially have 6 HTTP requests, whereas with the dynamic approach there would be 2 HTTP requests. When one includes the overhead of processing the TCP connection, writing HTTP log entries, parsing and checking permissions on the GET, etc. ... I'm just not sure which approach would chew up more CPU time. HTTP GETs aren't free, either. The Lizard