

Expired links should be less common - pg

We recently released a new version that uses constant urls for vote arrows and reply links on comments.  This should make "expired link" messages less common, because the supply of closure ids won't run out so fast.<p>The new code is gross, as I feared it would be.
In other applications you might be able to postpone this compromise.  The big problem for News.YC turned out to be crawlers.  They burn up closure ids as fast as real users, but the traffic you get from them is a function of the total size of your site.<p>We also made a few optimizations, so the site should be a bit faster.
======
jules
Do you think that continuations are the right model for web applications (does
this model still offer enough advantages if you have to make sure that you
don't have too many closures)?

~~~
pg
I think they're like using lists to represent stuff. They're good for
exploratory programming because they're extremely clean and flexible. When
your focus switches to efficiency, you can switch to other representations.

It's hard to beat closures for elegance. You say: generate a link, and if the
user clicks on it, run the following code. There's so much less to think
about. In a closure, state is implicit: if you refer to a variable defined
outside its scope, its value stays around. When you switch to putting state in
urls, you have to explicitly encode and decode each bit of state you'll need.
You also have to worry about bad things someone might do by sending requests
with different arguments. It's sort of like the difference between dynamic
memory allocation and explicit malloc, times 10.

~~~
icey
Would it be fair to say that the issue wasn't with closures and the web as
much as it was with the specific implementation of closures in news.YC?

[edited for grammar / clarity]

~~~
pg
Not so much the implementation of them, but the fact that the site used so
many. A crawler hitting some old item page with 20 comments on it would
generate at least 40 new closures, 20 for the upvote links and 20 for the
reply links. That adds up, now that there are almost 250k potential pages in
the site.

~~~
icey
Thanks for the explanation - This is useful for those folks out there who are
working with webservers that utilize continuations. There has been a ton of
discussion surrounding stateless and session based web development, but a
dearth of information regarding continuation based web development; especially
as it relates to sites that get a reasonably high level of traffic.

