web development in D programming

Kapps Kapps at NotValidEmail.com
Thu Nov 10 02:55:21 PST 2011


Speaking only for lighttpd, it didn't work too well for me when I tried 
it (using FCGI). First off, it does not seem to support multiplexing. As 
well as that, it had no way I could figure out for handling concurrent 
requests.

So, the way every single request goes is:
Lighttpd opens a connection with your FCGI handler.
Lighttpd sends a request.
You receive the request.
You handle the request.
You send a response.
Lighttpd closes the connection, and sends the user the response.
Lighttpd opens a new connection and sends the next request.

Overall, it was quite bad performance (it's of course possible that I 
was doing something wrong, but many hours of googling and testing could 
not figure out a solution). My basic test gave me about 75 requests / 
second on my test machine. I ended up writing my own server, which, in 
comparison to the 75 page loads per second or so I got with lighttpd, 
gives me around 1000. The difference is that mine supports concurrent 
requests, instantiating an instance of each Page per thread, and 
directly calls the D code instead of sending a request over the network 
/ to a different process (this is something that will need to have the 
option of being changed though, to support multiple servers, and change 
a dynamic page without shutting down the whole server to recompile). The 
server is not ready for release yet though, and is just an example to 
demonstrate inefficiencies/scaling in lighttpd for FCGI. It works well 
for PHP AFAIK, but I think it handles that directly with a plugin. It 
would also be possible to write such a plugin for D, and is likely a 
better alternative than making your own server.

I think lighttpd 2.0 may fix some of these issues though, including 
concurrency, and provides a new protocol that sends the Http requests 
directly. If so, that would likely be a good thing to use.

I also think Apache doesn't support multiplexing or concurrent requests, 
but this is something I could very likely be wrong on.

On 09/11/2011 5:58 AM, Dejan Lekic wrote:
> bioinfornatics wrote:
>
>>
>> I am a little disapointed, so if you have many request for a web page
>> this lib  http://arsdnet.net/dcode/ is usable or not ?
>>
>
> I am developing an implementation of the FastCGI protocol
> (http://www.fastcgi.com) in D2 with the main goal go have multiplexing
> support. However the development is slow due to the lack of time.
>
> I believe a good http server implementation would be appreciated by the
> community, but FastCGI server will make it possible to create a highly-
> scalable web applications using some of the well-known web servers (I use
> Lighttpd for an example).
>
> Your code is usable, but not production-ready.
>



More information about the Digitalmars-d-learn mailing list