Generators in D

Piotr Szturmaj bncrbme at jadamspam.pl
Wed May 18 17:21:01 PDT 2011


Jose Armando Garcia wrote:
>>
>> If serialization will be clever enough, these fibers could even be shared
>> across different servers! This is really a requirement in load balanced
>> environments.
>>
>
> A very old research paper (I think it was for the amoeba project)
> wrote a long time ago (I don't remember the wording) that is usually a
> bad idea to migrate already running tasks (process, thread, fiber,
> etc). Leading to the observation that it is probably best to do
> offloading/load-balancing before the work is started. That is how most
> modern scale-able architectures work. This is just an observation
> since you haven't exactly said how to use Fiber to save Http sessions.
>

There are some cases where it's useful. See SecondLife and EVE online. 
As for HTTP sessions, imagine some long wizard-like survey. User may 
fill half of that survey and may come back after week or so. She will 
start from the last checkpoint.
Of course such things are widely done using regular code, but fiber code 
would be certainly simpler and cleaner, and thus less error-prone.
There are of course some issues, f.i. how to deal with multiple 
requests/opened tabs or security issues. Such serialized fiber should be 
HMAC'ed and checked for authentication and integrity on deserialization.


More information about the Digitalmars-d mailing list