This is just a collection of some ideas after reading about this method. They have a single, persistent server process that either serves requests directly or is running behind apache. They even have a method to start the persistent server via some autostart.cgi executed by Apache.

CGI (multi-process) == problem

CGI is a problem, but also a reality. Some systems out there offer nothing more than CGI.

The special problems of plain CGI are those:

The problems with enhanced CGI (as in fastcgi or mod_python) and in all multi-process setups are those:

the hard way

The hard way of solving that would be to drop all CGI stuff and do some single-process-only approach (see URL at top of the page). We already have such servers (twisted-based and standalone). They can run behind apache.

Completely dropping CGI support is currently no option as it would make many of our non-root users really unhappy, because they maybe can't do another configuration.

But what would we win (if we did)? Don't panic, this is just theory!

If we would use just a single process, it would mean:

the soft way

So what could be the soft ways? Maybe we could think about favouring long-running stuff while keeping CGI possible.

Global Moin Lock (GML)

If moin would be designed to run single-process only (and not watch what's happening behind its back on disk), we could run it as CGI, but we would have to use a GML to avoid multiple processes running concurrently (or at least not running the critical areas in the code concurrently).

That would slow down CGI for wikis with many concurrent users (but CGI isn't best for that anyway), but would work for single users or wikis with low traffic.

We could do interpreter loading and module importing before locking as well as result output after releasing the lock, so at least those uncritical code parts could be done concurrently (for plain CGI). As that stuff takes quite some time and runs concurrently, the impact for normal page views wouldn't be dramatic.

The only real problems would be features taking lots of time in the locked code parts, like:

The GML could be realized by some storage.open(EXCLUSIVE) (and ...close()), so stuff could even run unlocked until storage access is necessary and continue to run unlocked after the close() call.

Using Apache multithreaded?

Apache2 internally supports multi-threaded operation (for static stuff).

Does this also work somehow for fastcgi or mod_python so there would be only one python and moin process, but multiple threads?

Comments

I don't think this approach to the problem(s) does help much. There are several problems that may be discussed but not all of them are related to CGI. I think it would make more sense to identify single problems and evaluate how much impact they really have and what could be possible solutions. I'd guess dropping CGI doesn't help in most cases anyway... So I suggest to refactor this page into the single technical issues and not keep it grouped to possible (wrong) solutions. -- FlorianFesti 2005-08-22 10:55:16

It is not only about existing problems (and how to solve them somehow), but a general design question:

MoinMoin: LimitingCgi (last edited 2007-10-29 19:19:18 by localhost)