[Tutor] Using jon.fcgi to speed up subsequent invocations
Jonathan Hayward http://JonathansCorner.com
jonathan.hayward at pobox.com
Fri Aug 15 21:06:25 EDT 2003
I have a search script that spends 90+% of its time in initialization.
One initialisation gets everything ready for multiple searches, so it
should speed up with fast cgi. I converted, or tried to convert it, to
jon.fcgi to use Fast CGI.
As is, I can't tell a performance difference. If I load the larger
dataset, a search takes ~20 seconds with or without fcgi. Do I need to
tell Apache something different to use it as a fast CGI script (what's
the URL to the relevant HOWTO)? Here are relevant snippets of my script:
import jon.cgi as cgi
import jon.fcgi as fcgi
class Handler(cgi.Handler):
def process(self, request):
multitasking.get_thread_specific_storage()["handler"] =
request.params
request.set_header("Content-Type", "text/html")
request.write(get_output())
if __name__ == "__main__":
init() # This is the really slow invocation that should only be
needed once.
fcgi.Server({fcgi.FCGI_RESPONDER: Handler}, 0, None, fcgi.Request,
0).run()
Thanks,
--
++ Jonathan Hayward, jonathan.hayward at pobox.com
** To see an award-winning website with stories, essays, artwork,
** games, and a four-dimensional maze, why not visit my home page?
** All of this is waiting for you at http://JonathansCorner.com
More information about the Tutor
mailing list