[erlang-questions] Erlang Web Libraries & Frameworks

Loïc Hoguin <>
Thu Aug 11 12:50:05 CEST 2011


On 08/11/2011 12:16 PM, Joe Armstrong wrote:
> On Thu, Aug 11, 2011 at 11:30 AM, Loïc Hoguin <> wrote:
>> On 08/11/2011 11:01 AM, Joe Armstrong wrote:
>>> If all suppliers of web- frameworks could adopt a common adapter
>>> pattern - it would make
>>> life a lot easier. I realize that this would not allow us to use some
>>> of the finer facilities
>>> offered by an individual web-server, but it would be very useful for the simple
>>> cases of serving up files etc.
>>
>> A lot of people choose the server based on those finer facilities.
>> Adaptor projects are already used by everyone else. See below.
>>
>>> One could have a common API then choose the implementation depending upon
>>> the requirements of the application.
>>
>> This is fine and all, but some servers use lists while others use
>> binaries. The handler code is obviously different so some servers would
>> require converting everything (headers, path, ...) to lists or binary
>> before passing the data to your common handler. There's no clean
>> solution there.
> 
> Right, that's why an adaptor is useful. I suspect the differences
> by accident rather than design. I would assume the "natural" way to
> transfer large blobs would be as binaries, and to communicate parsed
> attributes would be a Key-Value proplist of strings and so on.

Cowboy has been filling a demand for a fully binary server, so I don't
really agree with that. It's been designed that way by design, naturally
gains from that binary usage (Cowboy can require up to 2 times less
memory for the same number of connections). The other API changes are
also by design and actually OTPish rather than providing a fun to handle
your request. It also uses only 1 process per request instead of 2 in
other servers, again by design.

You should take a look at it, I've only had positive feedback on the
design so far but I'm always looking for ways to improve it, nothing's
set in stone yet. So if you've got the time, that'd be much appreciated!

> Having a well defined adaptor interface might have beneficial side effect
> of causeing the sofwtare at either side of the interface to migrate
> towards a set
> of common types in the interface.

I agree with that.

-- 
Loïc Hoguin
Dev:Extend



More information about the erlang-questions mailing list