开发者

Python web application: How to keep state

I wrote a WSGI compatible web application using web.py that loads a few dozen MB data into memory during startup.

It works quite well with the web.py integrated server.

However, using Apache 2 + mod_wsgi, every single request reloads the data, essentially starting the program again. Due to the loading time of several seconds, this is unbearable.

Is it i开发者_StackOverflownherent to mod_wsgi or can it be configured? What are my alternatives?


"Is it inherent to mod_wsgi?" No. It's inherent in HTTP

Since you didn't post your mod_wsgi configuration, it's impossible to say what you did wrong.

I can only guess that you didn't use daemon mode.

See http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#Defining_Process_Groups for more information on daemon mode.

This may not be the best solution. It may be better (far, far better) to use a proper database. Without actual code examples, and more details, this is all just random guessing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜