Forum OpenACS Development: Re: Threading and global scope: how to proceed?

Collapse
Posted by Gustaf Neumann on
Here is a short, simplified summary, how the sharing and threading model of aolserver works.

Upon startup, the server collects from all configured packages the -proc.tcl files and builds from these files a so-called blueprint (consider this as a single large file containing all the definitions). Aolserver uses threads for various purposes. For the handling of incoming HTTP requests, the "connection threads" (sometimes called "request threads") are used.

When a connection thread starts up, its interpreter is initialized with the blueprint. Therefore, every request has all procs/objects/global variables of the configured packages available without any loading.

Aolserver handles a pool of connection threads, every
connection thread serves typically several http requests (the number is configurable in the config file). After a connection thread has processed the configured number of requests (or an idle timeout) it shuts down. New connection threads are created upon needs.

After every request, the connection thread performs a cleanup that deletes e.g. the global variables (the variables in the namespace "::" of the tcl interpreter of the connection thread).

Connection threads are an important part of the picture, but there is much more infrastructure available: In addition to the connection threads, there are driver and spooler threads (naviserver), there are threads for scheduled procs, it is possible to define job-queues, one can define persistent threads, etc., there are options for lazy-loading, etc.

From your terminology, "global global" refers to the blueprint, and "local global" refers to the interpreter of the connection threads.

Hope this helps to understand the basic model.

Collapse
Posted by sal berg on
That's sort of how I envisioned it, and I was hoping it worked that way.

Thanks very much - now I know how to proceed.