|
Re: Is Cheetah thread safe?: msg#00008python.cheetah
On Fri, Oct 03, 2003 at 03:22:19PM +0200, JZ wrote: > I get awfull errors in __Cheetah_Temp... files. Webware is thread > safe, PSP (as I suppose) are also thread safe. What about the > Cheetah??? > > Is there any conflict in cache mechanism between WebKit and > Cheetah? > > Is there any way to make Cheetah using files instead of RAM > for cached templates? > > If I could not solve this problem, I am afraid, I had to reject > Cheetah and start to use PSP. O even worse. If it would work so slow, > my boss will decide to rewrite all code from Python to PHP (which > worked for us very fast in other projects) > > (I am using Python 2.2.3, Cheetah CVS and WebWare CVS) and I am using > only pure *.py and *.tmpl files. I am using #cache in some of .tmpl > files. I *have to* use cache of Webware (CacheServletClasses=1 and > CacheServletInstances=1) because without it the application works > *very slow*.) I'm not much of an expert on multithreaded applications, but here's what I know. Template instances are not thread safe. Each thread should instantiate its own template. Unfortunately, Cheetah's caching mechanism is not shared between instances, so you don't get the benefits of #cache in a multithreaded environent. #cache was meant for serial use of the same instance in the same thread. There's a planned rewrite of the caching system which may address this, but it won't be finished anytime soon. Webware servlets themselves aren't thread safe. Webware's designers decided that the convenience of setting state variables in .awake and reading them in .respond outweighed the theoretical advantages of thread-safe methods. However, Webware's servlet pool technology makes up for this limitation. Webware's servlet caching mechanism is considerably better adapted to Webware's use situation than #cache is. I would cache servlets and forget about #cache. If you do use the two together, you'd get a multiplication effect; that is, the cache variables would be refreshed only when *both* Webware's cache and Cheetah's #cache happen to be expired simultaneously. I suppose there may be some specialized uses for this. You don't say what the particular errors are, what kind of servlets you have, how you are using #cache, or when the errors occur, so I can't speculate further. -- -Mike Orr (aka. Sluggo), mso@xxxxxx (iron@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) http://iron.cx/ English * Esperanto * Russkiy * Deutsch * Espan~ol ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Is Cheetah thread safe?, JZ |
|---|---|
| Next by Date: | the "Cheetah files" (part 1), deelan |
| Previous by Thread: | Is Cheetah thread safe?, JZ |
| Next by Thread: | Re[2]: Is Cheetah thread safe?, JZ |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |