
Running Lisp in Production (2015) - tosh
https://tech.grammarly.com/blog/running-lisp-in-production
======
sacheendra
I like lisp as a programming language.

But, this article gives one of the reasons for avoiding its use in a high
performance production environment. Provisioning a VM with over 25GB RAM for
an application which requires about 4GB of it is a huge waste of resources.

While the common wisdom on HN is that for most applications, developer costs
more than physical resources. Physical resources still cost money.

Initially list might be a good option for development velocity. But, over time
as the application matures, adding features becomes more complicated and the
velocity goes down anyway. Shifting to something which reduces costs by upto
6x might be worth it.

~~~
orthecreedence
I wrote some high-performance lisp applications in production. My main was was
a threaded queue worker, driven off beanstalkd, that processed large volumes
of data. This was highly successful and didn't require overly-provisioned
servers (was using CCL/linux x64/linode VPS).

That said, I don't think I'll ever use lisp for front-facing web stuff again.
I wrote cl-async, and afterwards and used it in production in a few places,
then a bit later started using node heavily. The tooling for CL is just not
there. Quicklisp is great, but not being able to pick and choose package
versions is limiting, and having to rewrite every single thing for async was a
pain (since CL doesn't have continuations, any sort of async that avoids CPS
is impossible). I was hoping I would get more community support on cl-async,
and I did get many hands helping, but eventually it just became too much to
maintain. So if you're doing network stuff on CL, it's probably best to just
use threaded, which IMO just doesn't handle the same amount of load evented
does, at least when dealing with web APIs.

One thing I used lisp for briefly which I want to do again soon is game dev.
Being able to redefine/fix portions of your program while it's running is
fantastic, especially when you have huge amounts of state to deal with like
you do in games. I wouldn't exactly call that running CL in production,
though.

~~~
jaccarmac
FWIW, Qlot solves the version pinning problem. Not to discredit your
experience, just wanted to say that there are solutions today for the same
issue.

I'm interested exactly what the pain points are with CPS. Do you mean manually
rewriting in continuations is tedious or is there a more insidious issue. I
haven't tried writing async code in Lisp but macros would appear to eliminate
continuation-writing-by-hand.

~~~
orthecreedence
> macros would appear to eliminate continuation-writing-by-hand

They don't =]. There's cl-cont, but it's like building a house on a foundation
of toothpicks. Not to discount the work the author put in, but you can only do
very specific things with it, and last time I looked, error/exception handling
was pretty much completely missing.

> I'm interested exactly what the pain points are with CPS

Basically, for example, if I'm going to convert cl-postgres to use async, I
have to rip out the protocol parsing from the networking (they are often
globbed together) then I have to replace the networking with async and tie it
back into the protocol parsing. This in itself isn't too bad, but then
anything that calls the new async cl-postgres has to be converted to expect
async...all the way up. This can be somewhat alleviated by promises
([https://orthecreedence.github.io/blackbird/](https://orthecreedence.github.io/blackbird/))
but they still don't change the fact that _the entire stack is unwound once
you call into async_.

Continuations would allow building green threads/coroutines which would
eliminate CPS and allow you to preserve your stack while calling into async,
but CL is pretty much written in stone to not have continuations (or
coroutines et al) at this point.

Qlot looks handy, thanks for the tip.

~~~
TeMPOraL
> _then I have to replace the networking with async and tie it back into the
> protocol parsing. This in itself isn 't too bad, but then anything that
> calls the new async cl-postgres has to be converted to expect async...all
> the way up._

Isn't this the very consequence of going async? I'm reminded of the article on
this recently featured here[1]. Once you introduce async, you poison
everything up to the event loop (which, with usual async implementations, you
don't even see or control).

[0] - [http://journal.stuffwithstuff.com/2015/02/01/what-color-
is-y...](http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-
function/) \+
[https://news.ycombinator.com/item?id=16732948](https://news.ycombinator.com/item?id=16732948)

~~~
orthecreedence
> Isn't this the very consequence of going async?

Like I mentioned, depends on the language features. If it has coroutines/green
threads/continuations, you can use async without unwinding the entire stack.
CL will probably always have this problem, unless the bigger implementations
independently decide to implement the necessary building blocks (which they
probably won't).

Try explaining that to me 5 years ago, though.

~~~
TeMPOraL
If it's about avoiding stack unwinding, then maybe you could hack an
implementation with the condition/restart system? This is the one stack-
preserving feature in CL.

------
aeorgnoieang
> While the industry waits for LightTable and similar tools to mature, Lisp
> programmers have been silently and haughtily enjoying such capabilities with
> SLIME for many years.

Were a significant number of Lispers really waiting for LightTable to be
usable for them?

~~~
JamesLeonis
Clojure guy here, FWIW

The big deal with tools like LightTable is it's much easier for newcomers to
start working on projects. I understand why a user wouldn't want to learn both
a language and an editor. One huge issue we struggle with emacs/slime as the
editor of choice. Personally I'm a VIM guy, so I got it working there, but
that's after I spent some time deep in Vimscript and fiddling with plugins.
It's a lot to ask for people that are new, or those that have an editor of
choice that isn't supported.

~~~
cup-of-tea
Did you know emacs has several vi implementations? Many people think they are
the best versions of vi.

~~~
hellofunk
Except for lisp -- emacs vi implementations don't usually play as well with
parenthesis as native emacs, which is superb for lisp coding.

~~~
iLemming
you're wrong - Spacemacs offers very nice tools for structural editing out of
the box and including clever-parens layer. You can also use Parinfer or Lispy.
You can customize things to your liking using combination of Paredit and
Smartparens.

~~~
hellofunk
Only tried evil (which I think is the Spacemacs default?) with paredit and
while paredit is a truly stellar, evil mode does not play well with it.
Perhaps the other paren tools you've mentioned work better with evil? With
paredit, evil editing can delete only part of a paren leaving unmatched
problems.

------
Lionsion
> Fortunately, this obscure Stack overflow question helped
> [[https://stackoverflow.com/questions/442556/spec-for-junit-
> xm...](https://stackoverflow.com/questions/442556/spec-for-junit-xml-
> output)] — we ended up having to build this into our own testing library
> should-test.

> closed as off-topic by kleopatra, Martijn Pieters Jun 19 '15 at 19:55

All the best SO questions get closed.

~~~
Something1234
Seems completely justified to be closed. Although this does seem to fall in
scope as it would be very difficult to locate without knowing exactly what you
are after.

~~~
Waterluvian
Which is why it's probably fair that they're closed but not deleted.

~~~
Something1234
There really does need to be a tag for that kind of question.

Something along the lines of I'm looking for a spec about X, but I haven't had
any luck finding it.

~~~
keithnz
It's a bit of a tricky one as it may get downvoted / closed, but another
approach is to try and avoid asking for the resource and ask something like

What is the specification for X?

or

What is the name of the specification for X?

or

Is there a specification that defines the output of X?

While most of the answers will likely link to a resource, technically you
didn't ask for an offsite resource, however it may be seen as too broad , or
still may get closed for asking for offsite resources.

~~~
kazinator
To avoid making it too broad, don't ask "what is the specification of X" where
X is the whole darn can of beans. Ask about some small example instance which
falls under the X definition: what is the exact meaning of this Y
object/syntax/whatever, that can be input to system X?

