I didn't actually have much luck with running PyLucene within a FastAGI
instance. I used the combination of lighttpd + Flup and it worked just fine
until I placed some load on it.
Whether running in prefork or threaded mode, I would constantly receive
³Collecting from unknown thread² errors (which really surprised me in
prefork mode). I then thought that I could modify Flup to use the
PythonThread class. Unfortunately, Flup does not use the threading module
(of which PythonThread is a reimplementation of) but instead uses
³start_new_thread()² from the thread module to fire it¹s threads. Now, I¹m
sure that a thread-savvy pythonista could make this work but I just didn¹t
have the time to do it myself.
Instead, I utilized the built-in SimpleXMLRPCServer and a sub-classed
ThreadingMixIn:
import SocketServer
from SimpleXMLRPCServer import SimpleXMLRPCServer
class MyLuceneHandler:
def search(self, index, query):
# Do my search
pass
class MyThreading(SocketServer.ThreadingMixIn): def
process_request(self, request, client_address): """Start a new
PyLucene safe thread to handle the request.""" from PyLucene import
PythonThread t = PythonThread(target = self.process_request_thread,
args = (request, client_address)) if self.daemon_threads:
t.setDaemon (1) t.start() class ThreadingXMLRPC(MyThreading,
SimpleXMLRPCServer): pass if __name__ == '__main__': server =
ThreadingXMLRPC(('', int(sys.argv[1])))
server.register_instance(ProductsIndex()) server.serve_forever()
It¹s really quite simple and hasn¹t let us down just yet. With that being
said, if anybody has a working FastCGI method, I¹m all ears!!! I think the
benefits of using FastCGI from lighttpd are fantastic.
TJ Ninneman
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev