On Jan 21, 2005, at 11:03 AM, Chad Gard wrote:


On Jan 21, 2005, at 10:22 AM, Sean Davis wrote:

Do these need to all be generated on-the-fly? Or is there a way to create them first (one time a day, for example) and serve them as static images?

They need to be generated on-the-fly, as the data changes continually.



You could also have your main script generate the images all at once (at the same time as you are generating the HTML), put the graphics in temp files, and then put the appropriate URLs in the img tags. This will eliminate the overhead of calling a helper script 9-25 times for a single page. If you are on an intranet, serving 25 small images should be almost instantaneous.

Yeah, though then I have to worry about cleaning up the temp directory, and I'd like to avoid unnecessary writes to the hard drive (to avoid directory damage possibilities, energy use, fragmentation, etc). It logically makes sense to just send these things out as they're generated.



It does make some sense logically (but there are reasons it doesn't in the general sense), but, unfortunately, no one does it that way, so support is lacking for this kinda thing.


As for writes to the hard drive, it seems like a modern hard drive should be able to handle this load--how many hits a day are you expecting? And for cleanup, you can just set up a cron job that runs at 2:00 AM or something to remove all the files from your temp directory (assuming there are not thousands of files generated a day that might fill the drive), particularly if you are on an intranet and there is a low-use period. The only danger (besides filling the drive) is that a user's query fails in the couple of seconds between generating the HTML and pulling down the images because the files were deleted in the meantime.

Doing this probably won't take too long. I (and others) would encourage you to try it and see that it doesn't work before embarking on more exotic solutions, but let us know what works for you....

Sean


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to