On Dec 12, 2006, at 6:13 PM, Robert Landrum wrote:
> Alex Beamish wrote:
>> What I'm trying to do is come up with scaled page images from a
>> PDF on the fly. Thus, I want to launch Ghostscript and then ask
>> for a couple of page images. So, launching Ghostscript and getting
>> the first page might happen on the first request; subsequent
>> requests would come back to the Ghostscript session left running
>> from the first request, and thus would be able to quickly produce
>> the required page image.
>> Suggestions welcome.
>
> What you're gonna need is a daemon that lives outside of mod_perl.
> It's job will be to answer ghost script requests made from within
> your mod_perl handler, track open files, purge unused files, and
> generally do all the things you want to do. I don't really see a
> clean way to do it otherwise.
I'm going to agree with that.
There's no way to make sure that you'll have the same apache instance
handle each request. You need to either have an external daemon
handle sessions ( and apache + cookies will id which session a user
has ) or you'll need to forget about open files and resuming
sessions, and just open files on every request.
I'd probably go for the latter option. It sounds like you'll have a
lot of overhead with opening files on each request, but if you have
a daemon handle it, you're going to have to write a ton of logic to
handle
how many concurrent files can be open
what is the timeout
what happens on errors
my .02¢ -- keep the whole thing in MP, don't fork, write a
wrapperclass to "save state" and resume on what you're doing with the
ghostscript files, and serialize that data / save it with
Apache::Session.
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.