Re: Maintenance state
IWS <iws-VG7A+C9aekxy/[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.user |
|---|---|
| Message-ID | <[email protected]> |
Hi all, Wari Wahab <[email protected]> writes: > Another pyblosxom user who has been in the background but doing some > funny exploratory stuff is IWS, I don't even know his name, and can't > really read his website. You can look up his pyblosxom page @ > http://iws.dyndns.org/blog/net/pyblosxom This page is my masquerade place. My real name is deleted from the pages. So please call me IWS. > The second is the stability part. This, for me is 2.x stuff, so it's in > the back burner. Pyblosxom is not stable when runnning as a long > process, that is, when running as a webware servlet, or as mod_python > program. This is due to a few factors: > > * CGI program was in mind when designing pyblosxom > * Global variables everywhere especially in tools.py > * File locking needs fixing, when one instance of pyblosxom is > touching something, the other should just wait. > * Contention issues, globals in one state, when another instance wants > another state, etc. My pages don't reflect very recent results. I like to put them here. After/during developing new features of pyblosxom(MySQL interface, recent comment list, read more plug-in, and so on), I reach the same conclusion: - if we run pyblosxom as CGI processes, there is a possibility to do destructive operations simultaneously by the two process. It will cause strange errors in entryshelve (see: http://iws.dyndns.org/blog/net/pyblosxom/entryshelve-error.html It contains Japanese characters, but you can understand the contents.) So we need flock or something to prevent it. - if we run pyblosxom as thread in a process by mod_python, there is a possibility to do destructive operations simultaneously by the two threads. So we need semaphore or reference counter or something to prevent it. Anyway we need a concurrency control in pyblosxom. I thought providing reference counter for global variables in tools.py is easy and interesting than using flock for CGI pyblosxom. So I implemented it three weeks ago. In this approach, each instance of Pyblosxom calls two functions: tools.ref_registry() and tools.close_registry() to update a reference counter. The global variables are re-initialized and the cache is closed, only if the counter = 0 or after a long idle period. Otherwise, multiple Pyblosxom instances share variables peacefully. It seemed work well. In fact, during over three weeks observation of pyblosxom + entryMySQL + mod_python, I have never got any error! More stable than pyblosxom as CGI with entryshelve. The problem seems be solved. I can declare it, ....... maybe :-). > For this, a rewrite might be needed, in order to achieve such a robust > piece of code, while having the ability to run as a CGI process as well. I don't claim my code is robust, smart or worth to merge to the code. This is a result of experimental programming. But I hope this is a help. Please check my code, guru: http://iws.dyndns.org/src/pyblsxom/tools.diff (In this patch, I introduced a new storage variable for misc. cache.) http://iws.dyndns.org/src/pyblsxom/pyblosxom.diff Lastly, I'd like to add two more topics: 1. new cache method: cache/entryMySQL.py http://iws.dyndns.org/src/pyblsxom/entryMySQL.py As described above, I developed an interface to MySQL for a cache storage. It works well for three weeks. Since it still lacks a code for the database initialization: you must make a database and a table by hand, its version is 0.9. But it might become 1.0 in future without modification. Note: its performance has not examined yet. 2. comments.py can generate recent comment list http://iws.dyndns.org/src/pyblsxom/comments.py http://iws.dyndns.org/src/pyblsxom/comments.py.diff You can display a list of the most recent comments for jumping to the entries quickly. Since this feature depends to comments.py strongly, I decided not to make as a separate plug-in but an extension of the original comment.py. Please read the comment at the head of the source. sincerely, -- IWS-VG7A+C9aekxy/[email protected] ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click