Hi all,
I've recently become an avid Haskell fan, and the first thing I like to become familiar with in a new language is its status for web development. With a little research, it seems Happstack is the leading framework and community for this. However, IMO the visual identity of Happstack suggests strongly otherwise:
* The page at http://happstack.com/index.html has an extremely template-y feel. The same goes for http://tutorial.happstack.com/ -- automatic logo creation is the spawn of the devil.
* http://happstack.com/ doesn't sell itself at all -- a new prospective user doesn't want to know that "The Happstack project needs you!", she wants to know what Happstack is and why she should use it, in a concise jargon-free manner.
* happstack.com and tutorial.happstack don't complement each other at all. The Haddock documentation is different again. The wordpress blog is different again.
I could go on. In short I invite you to compare Happstack's web identity to any of the following:
But I'd like to help rather than criticize. Does Happstack currently have any identity documents? A logo of some sort? Color palette? These are the kind of things I'd like to get involved with.
Yes. happstack.com was autogenerated by a template, and later converted to happstack+HSP. But it is still just the output of a free site generator template.
* http://happstack.com/ doesn't sell itself at all -- a new prospective user doesn't want to know that "The Happstack project needs you!", she wants to know what Happstack is and why she should use it, in a concise jargon-free manner.
Indeed. I think Matthew just typed that up in a hurry when he launched the site, and it has never really been updated (as from fixing some typos).
On a related note, I have been asked to contribute an entry for happstack to HCAR.
So it would be good to come up with a better sales letter by May 1, and then use that on the site as well perhaps.* happstack.com and tutorial.happstack don't complement each other at all. The Haddock documentation is different again. The wordpress blog is different again.
Yes. I think the tutorial may even predate happstack itself :) The wordpress blog is not really maintained at the moment. Only matthew elder has posting permissions and he is temporarily out of service while raising a baby.
It might be cool to theme the haddock stuff -- not sure if anyone has ever tried that. We just use whatever haddock spits out.
So, the possible things to unify would be:our facebook pageour twitter pagethe documentationI could go on. In short I invite you to compare Happstack's web identity to any of the following:
No need :)But I'd like to help rather than criticize. Does Happstack currently have any identity documents? A logo of some sort? Color palette? These are the kind of things I'd like to get involved with.
At present, no. However, after the release of 0.5 (this week hopefully),
documentation is going to be the primary focus. Unifying the identity and branding is a highly complementary task. So, good timing :)The author of this logo suggested we use it for happstack,
--I am rather fond of it, but I have not yet come up with a description of why it represents happstack :)The only thing I am especially attached to about the current site is that it is (1) actually powered by happstack (2) the source is available via a public darcs repo so that people can submit patches:I would like to retain those two aspects. I would prefer to stick with darcs/patch-tag because that is what we already use for everything else. (And patch-tag is written in happstack, so we like to support it).What is the next step? Perhaps it is defining happstack with out using any buzzwords?- jeremyYou received this message because you are subscribed to the Google Groups "HAppS" group.
To post to this group, send email to ha...@googlegroups.com.
To unsubscribe from this group, send email to happs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/happs?hl=en.
lol. That is very harry potter :)So, here is some unorganized, hand wavey, high conception ideas about happstack for you.The happstack project is focused on making it easy to build an server application which can grow to support a large number of users with out turning into a huge hack job.Although a majority of the effort is currently focused an delivering *web* applications, the framework is not limited to only web applications. For example, for april fools I released a telnet based happstack application.One principle of happstack is to not try to use a one-size fits all solution. If you look at big systems like eBay, amazon, facebook, etc, you find that they often even up with very customized, non-general solutions. For example, if you look at a system like facebook.com, they started with php+mysql, and still continue to use it. But they use mysql in a way that would make database designers cry. They use no transactions, etc, and all their tables just have two columns (key/value pairs). They don't use SQL joins, but instead simulate the joins in PHP. It's clear that their needs have outgrown the system, and they have been forced to hack weird stuff on top what they had, because you never have time to rewrite it from scratch.Trying to generalized facebook's system so that it could be used by amazon, ebay, etc, just wouldn't work. So, rather than attempt to make a general solution that is going to work for everyone, we want to make it as easy as possible for you to create the specialized solution that works for you. So, for example, happstack does provide a persistent data storage system, but you are not mandated to use it. If SQL *is* the best solution for your app, it is just as supported as happstack-state.Along similar lines, happstack has no *builtin* html templating solution. But we do make it easy to use, HSP, HStringTemplate, Text.(X)Html, and soon Hamlet. And, if you come up with your own homebrewed thing that is best for your app, then that should work just as well. This is important because different templating systems meet different goals. HSP is nice and rather powerful if you have Haskell programmers writing the html. But if you want an html designer to implement the pages, then you might want something more familiar and less powerful to give them.So, part of the happstack project is taking 3rd party technologies and integrating them nicely into the happstack eco-system.Of course, too much choice can be problematic. So, another part of the happstack project is trying to establish some reasonable 'best practices' for people to start their projects with. For example, we think that happstack-state is a great choice for many applications, and can simplify development and deployment, and can be easily modified to meet the specific needs of your site. So we want to foster the growth and adoption of that technology, and show people why they might want to consider it over SQL.In the most abstract sense, as you continue to develop and grow your application, you might actually end up with an application that does not use any code from the happstack project itself. As your site grows and adapts, you might find you have replaced all the happstack code with your own custom code. That is perhaps a bit unlikely, but conceptually, it is a fine idea. In that sense, happstack is not just the code, but the philosophy about how to design and build a site that is going to be able to adapt.So, adaptation is a pretty key concept I think. All businesses, websites, ideas, etc, that fail to adapt will die. If you are using a framework which makes it hard to adapt your site as your site grows, then you are going to be in a world of pain. What you need is a system that will allow you to adapt your site as easily as possible.In fact, I think the idea of 'web frameworks' has a tendency to put the emphasis as the framework being the king, and your application a humble servant of it. Which is clearly all backwards. Your web application is the only thing that matters, and if some of the functions and data structures in the happstack project make it easier to write your application, then great! But the libraries should always be the servant of your application.So, I am still working on refining this ramble down into something more meaningful...There is also a lot of stuff that is missing from this rant too :)I would *almost* consider happstack to be a community resource for people building application servers using Haskell. It would include discussions about solutions to various problems encountered while building web applications, recommended practices that will help keep your code adaptable, and a collection of libraries and tools which have been useful for addressing these problems, and which have been polished so they work well together.For example, one idea that has come up in the scalable application server realm is the idea of getting away from disk and using DRAM clouds.
On 24 Maj, 23:57, Andrey Chudnov <achud...@gmail.com> wrote:
> @All: I think Snap framework is worth having a look at
> (snapframework.com), though right now it's only a web-server and a
> template system (both look pretty darn good). They claim to have
> beaten the Happstack web server performance (http://snapframework.com/
> benchmarks). Also, they've got excellent documentation.
I've found it quite interesting on the benchmark page that Happstack
fared so well in comparison to Apache/PHP!
How hard would it be to implement pipelining?
How hard would it be to support libevent?
--
Gracjan
On 24 Maj, 23:57, Andrey Chudnov <achud...@gmail.com> wrote:@All: I think Snap framework is worth having a look at(snapframework.com), though right now it's only a web-server and atemplate system (both look pretty darn good). They claim to havebeaten the Happstack web server performance (http://snapframework.com/benchmarks). Also, they've got excellent documentation.
I've found it quite interesting on the benchmark page that Happstack
fared so well in comparison to Apache/PHP!
How hard would it be to implement pipelining?
How hard would it be to support libevent?
On 25 Maj, 23:33, Jeremy Shaw <jer...@n-heptane.com> wrote:
> On May 25, 2010, at 3:36 PM, Gracjan Polak wrote:
>
> > I've found it quite interesting on the benchmark page that Happstack
> > fared so well in comparison to Apache/PHP!
>
> yay!
>
> > How hard would it be to implement pipelining?
>
> Not sure it is really worth it. Happstack does support multiple
> request/responses over the same persistent connection. So we are not
> paying the overhead of setting up a new connection for each request.
> Pipeline just allows you to send all the requests at the beginning,
> instead of interleaving the request/response pattern. But it doesn't
> seem like that would be a very big win.
Ok, I read about pipelining and understand why it is not worth the
trouble.
Still the other day I got some responses with Connection: close when I
did not expect that. What can possibly be the reason?
--
Gracjan
> How hard would it be to implement pipelining?
>
> Not sure it is really worth it. Happstack does support multiple
> request/responses over the same persistent connection. So we are not
> paying the overhead of setting up a new connection for each
> request. Pipeline just allows you to send all the requests at the
> beginning, instead of interleaving the request/response pattern. But
> it doesn't seem like that would be a very big win.
Re: pipelining, if you support keepalive on the server side you
shouldn't have to do anything special to handle pipelined requests. The
performance issue we were seeing w/ happstack-server & sendfile is that
it doesn't seem to support keepalive for sendfile requests, at least in
our testing.
> On my machine, with a single core, and a slightly tweaked file serve
> test, I got essentially identical results for the image serving
> test. This makes sense, as most of the time is spent in sendfile
> anyway. I believe most of the speed differences in that test are due
> to running snap on 4-cores vs 1-core for happstack.
Yes, in theory fileserve performance *should* be identical (modulo the
speed of http parsing), we use the same sendfile library :)
BTW from looking at the sendfile library, it looks like it could be a
bit faster, at least on posix -- Word64 might be better than "Integer"
for offset and bytecount, doing an fstat() on posix probably a bit
faster than hFileSize, etc.
Wonder how much difference those changes would actually make -- GMP is
pretty slow.
> How hard would it be to support libevent?
>
> Both easy and hard. My experimental port of happstack-server to wai
> shows that it is not that hard to retarget happstack-server to a new
> backend.
>
> The 'hard part' is writing the backend itself I suspect. In theory, I
> would like to just leverage an existing (iteratee) backend, such as
> hyena. However, I've been waiting to do that for a year.. so maybe it
> would just be better to bite the bullet and add something custom for
> now.
It shouldn't be too much work to make happstack apps run on top of Snap
if anyone is interested.
G
--
Gregory Collins <gr...@gregorycollins.net>
> Jeremy Shaw <jer...@n-heptane.com> writes:
>
>> How hard would it be to implement pipelining?
>>
>> Not sure it is really worth it. Happstack does support multiple
>> request/responses over the same persistent connection. So we are not
>> paying the overhead of setting up a new connection for each
>> request. Pipeline just allows you to send all the requests at the
>> beginning, instead of interleaving the request/response pattern. But
>> it doesn't seem like that would be a very big win.
>
> Re: pipelining, if you support keepalive on the server side you
> shouldn't have to do anything special to handle pipelined requests.
> The
> performance issue we were seeing w/ happstack-server & sendfile is
> that
> it doesn't seem to support keepalive for sendfile requests, at least
> in
> our testing.
Right. We don't do anything special.
Turns out there was a bug where we were setting the close connection
header for sendfile for no good reason. That is fixed in darcs now.
>> On my machine, with a single core, and a slightly tweaked file serve
>> test, I got essentially identical results for the image serving
>> test. This makes sense, as most of the time is spent in sendfile
>> anyway. I believe most of the speed differences in that test are due
>> to running snap on 4-cores vs 1-core for happstack.
>
> Yes, in theory fileserve performance *should* be identical (modulo the
> speed of http parsing), we use the same sendfile library :)
Right. Though we might have some extra overhead in our fileserve
library.. such as the giant list of mime-types.
> BTW from looking at the sendfile library, it looks like it could be a
> bit faster, at least on posix -- Word64 might be better than "Integer"
> for offset and bytecount, doing an fstat() on posix probably a bit
> faster than hFileSize, etc.
>
> Wonder how much difference those changes would actually make -- GMP is
> pretty slow.
Dunno. But I have commit access if you send a patch. (And maybe some
test results to show it makes a difference?)
>
>> How hard would it be to support libevent?
>>
>> Both easy and hard. My experimental port of happstack-server to wai
>> shows that it is not that hard to retarget happstack-server to a new
>> backend.
>>
>> The 'hard part' is writing the backend itself I suspect. In theory, I
>> would like to just leverage an existing (iteratee) backend, such as
>> hyena. However, I've been waiting to do that for a year.. so maybe it
>> would just be better to bite the bullet and add something custom for
>> now.
>
> It shouldn't be too much work to make happstack apps run on top of
> Snap
> if anyone is interested.
It is certainly tempting. I have been hoping to port to hyena for a
long time, but that project seems a bit stalled perhaps?
The unpredictable nature of lazy I/O is not a good thing, so I think
iteratees are ultimately the way to go for happstack.
There are two approaches we can take:
1. just rip out the current backend and use a different one (what I
did with the happstack-wai port)
This method has a few advantages:
1. less code in happstack to maintain
2. more people using the backend == more bug fixes and
performance improvements
2. extend the current backend to also work with iteratees. For
example, extend the Response type so that in addition to the current
Response constructor that uses lazy I/O it also has a Response that
uses iteratees.
The advantage of the second method is that it results is less code
breakage, because it is just adding new stuff. Then we can phase out
the old stuff.
But, I think the breakage is maybe not that bad anyway. Most of the
code that is generating Responses goes through a toResponse call
anyway. If we just modify all the default ToMessages instances, then
most code won't require much in the way of changes. And people can
just use enumFromLazyByteString or something to convert their own
instances.
Obviously, they won't get the full benefits of iteratees that way, but
if they are just looking to migrate their app, it ought to be pretty
painless.
The biggest 'issue' with a port to the snap backend right now is that
the part happstack wants to use is all mixed up with the rest of the
code. For example, Snap.Types has the Request and Response types,
which happstack would use, but also the Snap monad. And snap-core
contains the types we want, but also things like file serving
utilities. We can, of course, ignore the things we don't want.. but
when those things also add even more cabal dependencies, that is
annoying. Happstack already has too many dependencies.
- jeremy
This has bit me in past projects, wher I've had wget hanging on me at the console because having happstack send a content-length header would have destroyed performance.
Maybe wget was doing something funny, though.
On May 25, 2010 5:39 PM, "Jeremy Shaw" <jer...@n-heptane.com> wrote:
On May 25, 2010, at 4:50 PM, Gracjan Polak wrote:
>
>
> On 25 Maj, 23:33, Jeremy Shaw <jer...@n-he...
If you were serving files, it is because I just fixed a bug in the sendfile code. If it was something else.. then I would need more details.We use keep-alive provided when these conditions hold:continueHTTP rq res = (isHTTP1_0 rq && checkHeaderBS connectionC keepaliveC rq) ||(isHTTP1_1 rq && not (checkHeaderBS connectionC closeC rq)) && rsfContentLength (rsFlags res)Which is basically:HTTP 1.0, but they requested keep-aliveHTTP 1.1, they *didn't* request a close, and the content we are sending includes a content-length.- jeremy
--
You received this message because you are subscribed to the Google Groups "HAppS" group.
To po...
> The biggest 'issue' with a port to the snap backend right now is that
> the part happstack wants to use is all mixed up with the rest of the
> code. For example, Snap.Types has the Request and Response types,
> which happstack would use, but also the Snap monad. And snap-core
> contains the types we want, but also things like file serving
> utilities. We can, of course, ignore the things we don't want.. but
> when those things also add even more cabal dependencies, that is
> annoying. Happstack already has too many dependencies.
I was thinking instead of a package "snapstack", which exports a
function:
snapstack :: ServerPartT IO Response -> Snap ()
and also an
httpServe :: ... -> ServerPartT IO Response -> ... -> IO ()
Basically: convert the request/response types and run the happstack
monad. The conversion would be a little bit of fixed overhead.
> We use keep-alive provided when these conditions hold:
>
> continueHTTP rq res = (isHTTP1_0 rq && checkHeaderBS connectionC keepaliveC rq) ||
> (isHTTP1_1 rq && not (checkHeaderBS connectionC closeC rq)) && rsfContentLength (rsFlags res)
>
> Which is basically:
>
> HTTP 1.0, but they requested keep-alive
>
> HTTP 1.1, they *didn't* request a close, and the content we are
> sending includes a content-length.
Why don't you do chunked transfer encoding on http/1.1?
But, if we are converting the existing happstack Response type into a
snap Response, then we wouldn't be able to use iteratees?
Also, it just complicates the code even more than it already is. Adds
even more monads!
What is the advantage of doing things that way over just using the
snap Request/Response types natively?
It would be useful if we simply want to use some existing happstack
code in a snap application. But the goal is to 'permanently' improve
the the happstack server backend and get rid of the existing lazy I/O
code altogether..
- jeremy
I assume you are asking why we don't use chunked transfer encoding
when we don't know the length so that we can support keep-alive even
in that case?
I think it's because all the people interested in writing low-level
http server code are working on their own servers instead of
contributing to happstack :p
It's not too late though, you can still submit a patch ;)
- jeremy
> But, if we are converting the existing happstack Response type into a
> snap Response, then we wouldn't be able to use iteratees?
Yeah it'd strictly be a compatibility layer.
> Also, it just complicates the code even more than it already is. Adds
> even more monads!
>
> What is the advantage of doing things that way over just using the
> snap Request/Response types natively?
You get to run existing happstack code without modification, that's it.
> It would be useful if we simply want to use some existing happstack
> code in a snap application. But the goal is to 'permanently' improve
> the the happstack server backend and get rid of the existing lazy I/O
> code altogether..
If you would want to move ServerPartT closer to Snap then you may as
well just *use* Snap, the monad is almost identical after all.
> I assume you are asking why we don't use chunked transfer encoding when we
> don't know the length so that we can support keep-alive even in that case?
>
> I think it's because all the people interested in writing low-level http server
> code are working on their own servers instead of contributing to happstack :p
>
> It's not too late though, you can still submit a patch ;)
Touche! :)
It would be useful if we simply want to use some existing happstackcode in a snap application. But the goal is to 'permanently' improvethe the happstack server backend and get rid of the existing lazy I/Ocode altogether..
If you would want to move ServerPartT closer to Snap then you may as
well just *use* Snap, the monad is almost identical after all.
The bulk of new development for Snap will happen outside of snap-core
and snap-server. We're sensitive to dependency creep and intend to
keep -core and -server is simple as possible.
It is certainly tempting. I have been hoping to port to hyena for a long time, but that project seems a bit stalled perhaps?
> I can get all those things out of the snap-core + snap-server
> libraries. But, I am concerned that as snap grows, I will start
> needing a bunch of extra dependencies that have nothing to do with
> those 4 features.. :-/
The snap-core library is going to stay roughly where it is going forward
-- probably any additional utilities to go in there will be in the
"doesn't introduce additional dependencies" category. We're planning on
putting Snap's more "frameworky" stuff in other packages.
This was a huge lesson from xmonad: keep the dependencies very light for
basic functionality, or the distros -- and thus users and end-user
facing apps -- can't keep up.
-- Don
On 26 Maj, 21:54, Johan Tibell <johan.tib...@gmail.com> wrote:
> Unfortunately I haven't had any time to work on Hyena for a long time. I've
> been yak shaving, trying to improve the GHC I/O manager so that all Haskell
> web servers can benefit from better performance (if you want to help please,
> please try out the code on github [1] and report bugs).
I find your work on GHC I/O really interesting and important. It seems
to be a bit above my level of Haskell expertise, though. Anyway if you
need assistance with for example Windows port or testing I'd glad to
help.
--
Gracjan
> Running this server (it can be built using the Makefile) could help us
> find bugs on different platforms. For Windows support we still need to
> write a select() backend. This should be pretty easy as it can be
> modelled after the poll backend:
For Windows we really should be using I/O completion ports. Huge pain
in the butt though!
Johan Tibell <johan....@gmail.com> writes:For Windows we really should be using I/O completion ports. Huge pain
> Running this server (it can be built using the Makefile) could help us
> find bugs on different platforms. For Windows support we still need to
> write a select() backend. This should be pretty easy as it can be
> modelled after the poll backend:
in the butt though!
Using the function in EventSocket it's possible to build a server in typical Haskell style, using forkIO to handle each request. Bryan wrote a small HTTP server using this interface
http://github.com/tibbe/event/blob/master/benchmarks/StaticHttp.hs
You won't see much a difference unless you push it past 1024 open
connections -- event-based server will keep processing requests,
GHC-IO-manager-based-server will start refusing requests.
When I tried that I got,
~/n-heptane/projects/haskell/event/benchmarks $ ./static-http
static-http: accept: resource exhausted (Too many open files)
:-/
- jeremy
--
You received this message because you are subscribed to the Google Groups "HAppS" group.
To post to this group, send email to ha...@googlegroups.com.
To unsubscribe from this group, send email to happs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/happs?hl=en.