Boost logo

Boost :

Subject: Re: [boost] CGI / FastCGI library update
From: Darren Garvey (darren.garvey_at_[hidden])
Date: 2010-05-20 16:52:17


On 20 May 2010 20:54, Artyom <artyomtnk_at_[hidden]> wrote:

>
> I'd rather prefer to write in the beggining
>
> boost::cgi::acceptor ac;
>
> if(scgi)
> ac.open(scgi,tcp::ip);
> else
> ac.open(fcgi,unix)
>

Doesn't this suffer from having to link support for SCGI and FastCGI into
any application that uses the library?

This could be implemented as a higher-level wrapper over the components I'm
proposing.

> boost::cgi::request r
> ac.accept(r);
>
> Rather checking if it is scgi of fcgi at every point.
>
> As I can see from your code you ave each class type of each protocol.
> And it is bad (IMHO)
>

You can use templated functions and handle them all the same way.
fcgi::request and cgi::request are different types, but they have the same
functions, interface and semantics. A single function:

template<typename Request>
void handle_request(Request& req);

can work transparently with any protocol.

In the linked example (as ugly as it is), you can use any request type in a
uniform way with request_handler:

https://svn.boost.org/trac/boost/browser/sandbox/SOC/2007/cgi/trunk/libs/cgi/example/xcgi/server1/main.cpp

> The goal of supporting multiplexing is less about pure
> > speed than about
> > resources. Having 1 connection per request means you can
> > only support N
> > simultaneous requests, where N is not really that huge of a
> > number on most
> > machines.
> >
>
> epoll/kqueue/devpoll allows you support them efficiently
> and N as bis as number of file descriptors in process.
>
> 10,000 is low? I don't think so (see 10K problem)
>

It's not a huge number is it?* 10K simultaneous connections was an issue
when the C10K paper was written, and AFAICT it's still an issue.

Roy Fielding and his "Waka" are worth reading about if you don't see the
point in multiplexing. His arguments are very convincing.

Cheers,
Darren

* Earth's population is increasing by about 9K people / hour, according to
the CIA factbook.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk