[AWS] Concurrency in AWS

Pascal Obry pascal at obry.net
Thu Sep 6 19:42:04 CEST 2007


Maciej,

> I understand that AWS is a multitasking server that can handle many 
> connections in paraller. This has some consequences in how the server 
> interacts with the user-provided code via dispatchers, and this 
> interaction is not very well documented.
> 
> Please let me know whether the following is precisely true:
> 
> 1. There can be many concurrent (overlapping) invocations to Dispatch 
> subprogram provided by the user.

Yes.

> 2. Some of these concurrent invocations can actually affect the same 
> physical Handler object in a given time.

Yes.

> 3. Some of these concurrent invocations can affect separate (distinct) 
> copies of the Handler object in a given time.

I would say no.

> 4. The user should never assume that his Handler object will be actually 
> directly affected by any Dispatch invocation. Instead, the copy of the 
> provided object can be used (that's why Handler provides refcounting 
> functionality).

No there is no copy.

> 5. The user should not assume that his Handler object will persist for 
> longer than a single invocation to Dispatch.

Of course it can assume that. The handler is an object that the user has
passed to the server. Or I'm not clear on what you are asking :)

> In addition:
> 
> Is it possible to keep some "task local state" that would be bound to 
> the internal server task handling client connections?
> The motivating example would be to create a pool of database 
> connections. If the programmer decides to have the pool of database 
> connections of the same size as Max_Connection parameter, then keeping 
> the database connection object directly with the AWS task would nicely 
> solve the problem of pool management.

Yes, I don't see why this should not be possible. AWS internally use
task attributes to store information (see AWS.Server body).

Hope I got all right :)

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



More information about the AWS mailing list