Introducing vibe.d!
Sönke Ludwig
sludwig at outerproduct.org
Fri Apr 27 05:24:36 PDT 2012
>
> Sönke, vibed is truly amazing! I am interested in the web server's internal
> architecture. I always wanted to do an implementation of a web server using
> a form of asymmetric, multi-process event-driven architecture. A web server
> which utilises fibers. It would be nice if you explain the web-server
> architecture of vibed in more details.
>
> Keep up with good work!
>
> Regards
Thanks! I will add a page with graphical explanation on the website when
I have some time. But in short all fibers are currently living in the
same thread. Each fiber is registered with one or multiple events inside
of the event driver (libevent based currently). As soon as an event
arrives, the corresponding fiber is resumed. The fiber will then simply
do conceptually this for every blocking operation:
blockingOperation(){
requestOperation();
while( !operationFinished() ) yield();
}
I've thought about sharing fibers across threads but came to the
conclusion that this is probably more trouble than it's worth. An
alternative would be to start multiple event loops in separate threads
and then distribute incoming connections to these loops before starting
a corresponding fiber.
Right now its at least possible to off-load all computational tasks
using std.concurrency or std.parallelism or similar. An efficient
asynchronous wait function for a std.concurrency message or for a
std.parallelism task would be useful though.
More information about the Digitalmars-d-announce
mailing list