python - A scalable solution for sharing objects between threads in web.py (+ flup/fcgi) -
i need share object between threads in web.py. i'm running web service performs calculation & returns value. calculation done using object takes quite lot of memory, don't want created each request.
i have solution works fine, doesn't seem scale:
import web urls = ('/', 'index') class index: def get(self): ... result = web.myobject.docalculation() return result if __name__ == "__main__": app = web.application(urls, globals()) web.myobject = loadobjectfromfile app.run()
web.py automatically opens 10 threads, number fixed, , it's limiting. can change that?
the web.py install guide recommends using flup + server lighttpd, or apache. can done while retaining shared object feature need? can tell me how?
i installed flup , added "fcgi" command line parameter when starting server. gave me desired behaviour in terms of threads (unlimited number), of course didn't perform task. fcgi sever needs defined, think. can fixed without running lighttpd, or apache?
Comments
Post a Comment