Ask HN: What are the alternatives to Amazon Lambda? - gamesbrainiac
======
skrebbel
In a way, Amazon Lambda is just "upload a PHP script to my $3 shared webhost",
except:

    
    
       - JavaScript/Java/Python instead of PHP
       - Can handle gigantic bucketloads of requests per second, transparently
    

If you don't expect to scale super high, and if the actual language isn't
sacred to you, then you can get the exact same ease of deployment and a
comparably large ecosystem of open source on your favorite el cheapo webhost.

Many of the reasons Lambda is attractive are the same reasons PHP became so
popular (despite the not-so-awesome language).

~~~
k__
This is where PHP can really shine.

I mean, you simply upload a script to a web server and have a new API
endpoint...

~~~
goldenkey
You realize that Python, Perl (cgi), and even C, can do the same things?
mod_xxxx

~~~
toyg
In practice, you can't: stuff like mod_python was never popular and never
really gained a foothold in the shared-hosting market.

Deploying a python script today means either building a VPS or hunting for a
niche provider like webfaction (which will still need you to drop to the shell
in most cases anyway). It's another level of skill required.

------
andrewstuart2
One thing that strikes me as having really promising possibilities for doing
something Lambda-esque is systemd socket activation [1]. You can essentially
have no running services, and systemd will hold open a socket (port/unix/etc)
and then it will spin up a given service if a request is made on that socket.

As long as you build your "service" to handle a single request and shut down
(maybe have an external db-access service to avoid add'l connection overhead),
I'd imagine you get something very similar to what Lambda offers - high
density, on-demand computing.

[1] [http://0pointer.de/blog/projects/socket-activated-
containers...](http://0pointer.de/blog/projects/socket-activated-
containers.html) and [http://0pointer.de/blog/projects/socket-
activation.html](http://0pointer.de/blog/projects/socket-activation.html)

~~~
rakoo
As others have said, this is basically what inetd and the likes have been
doing for a long time. The reason why it isn't used for heavy services anymore
is that every request will spawn a new process, and that's extremely
expensive. That's like CGI at the socket level. The natural "solution" you
have is to let your process run, and every time a new request comes from the
network, it is merely redirected to your process, possibly under another
format; that's FastCGI for you. But then you lose the simplicity of
programming your process as if it were called for every request.

The real innovation that Lambda brings on the table is container reuse [1].
Basically your process is started in a container the very first time a request
hits Lambda, and the initialization step happens; when it's done the container
is "snapshotted" and runs the request. If the request has been completely
processed, the process should normally close, but instead the container is
kept hot for the next requests. If they come not too far away, the container
will be reused, right after the snapshot, as if it was run for the first time.

Because of this trickery having many requests is not so expensive anymore,
there can be very little latency. Bring that to everyone and
inetd/xinetd/systemd's socket activation can be seriously considered as a
viable solution.

[1] [https://aws.amazon.com/blogs/compute/container-reuse-in-
lamb...](https://aws.amazon.com/blogs/compute/container-reuse-in-lambda/)

~~~
andrewstuart2
Seems like you could essentially implement an LRU container/process/etc.
keepalive on top of <insert socket activation tech> and have your machines
essentially fully-utilized with minimal latency for services being accessed
recently.

~~~
rakoo
No, what Lambda does is take your equivalent of CGI script, init it once and
reuse the snapshot afterwards. It is completely oblivious to the process. As
far as it is concerned, your script is just "take this from STDIN, do the
magic, write on STDOUT and exit". There is no notion of keepalive because the
script itself isn't supposed to stay alive. All the magic happens in the
_execution_ of the script.

------
neilellis
Iron Workers: [http://www.iron.io/worker/](http://www.iron.io/worker/)

Most new breed Docker hosts like [http://tutum.co](http://tutum.co) can give
you a quick DIY version.

But in general they (Amazon) are (currently) the best of breed and I have only
positive things to say having used the JS and Java versions.

~~~
dchesterton
We're using IronWorker and Lambda for a current project. Our (Go) code can run
on either and we've designed the app to easily swap out the backend in case of
service failure.

Pros of IronWorker: More language support, better logging, easier to debug,
scheduled tasks via API (this is the main thing stopping us going all in on
Lambda).

Cons: Slower start up time (~2-3s on average compared to milliseconds with
Lambda), pay upfront rather than pay for what you use, no choice re. CPU/RAM.

~~~
vosper
You may be interested to know that Lambda now supports scheduling:
[https://aws.amazon.com/blogs/aws/aws-lambda-update-python-
vp...](https://aws.amazon.com/blogs/aws/aws-lambda-update-python-vpc-
increased-function-duration-scheduling-and-more/)

Edit: Oh, are you saying that you want to send an API call to schedule
something? They say in the post that API support is coming, but I don't know
if you could schedule a one-off run that way.

~~~
dchesterton
Yeah, we connect with other services so we need the ability to
programmatically re-schedule a function to run in ~5 minutes if it failed the
first time.

------
mands
We've been hacking on something in this space for the past few months with
StackHut - [https://www.stackhut.com](https://www.stackhut.com). We have a
demo in a blog post at [http://blog.stackhut.com/phantomjs-
cloud/](http://blog.stackhut.com/phantomjs-cloud/) showing headless web
rendering-as-a-service.

We've tried to make it as simple as possible to get your code into the cloud.
You write your classes and they're deployed as entrypoints into a lambda-esque
service that you can call over JSON-RPC - making it trivial to write and
deploy a backend.

As described in the blog, the great thing we think it has over tools like
lambda is that you can describe your system declaratively, specifying any
dependencies you may need, using a simple YAML file and it takes care of
packaging your code. You can run this locally or deploy it to our hosted
platform where it scales as needed.

Currently support JS and Python atm, and open-source at
[https://www.github.com/StackHut](https://www.github.com/StackHut). We're
super early but would love to hear your thoughts.

~~~
kixa
I've been using StackHut loads recently. Though it's more of a replacement for
using AWS Lambda and AWS Gateway together.

There's a CLI tool and you can deploy literally any function you've declared
locally which StackHut then automagically available through HTTP, no web
server routing or request handling required (on server side at least).

It's a super fun idea and it's surprisingly easy to get started with. If
you've got some free time this weekend, totally check it out.

------
vmarsy
What about Azure Service Fabric [1]? It seems a bit different that it doesn't
even require you to have S3* /database storage. You have access to in-memory
distributed and resilient data structures [2] right in your code.

They seem to provide Chaos and Failover tests (à la Netflix Chaos monkey but
out of the box.)

[1] [https://azure.microsoft.com/en-us/campaigns/service-
fabric/](https://azure.microsoft.com/en-us/campaigns/service-fabric/)

[2] [https://azure.microsoft.com/en-
us/documentation/articles/ser...](https://azure.microsoft.com/en-
us/documentation/articles/service-fabric-reliable-services-reliable-
collections/)

*or Azure S3's equivalent

------
buu700
Google App Engine includes pretty much the same thing, except it's more mature
since it's been around for ages. (JS isn't among its supported languages
though — Go, Java, Python, PHP — but IIRC they may have recently added some
kind of language-agnostic runtime.)

~~~
johansch
To me AWS Lambda is like a Brazil-like nightmare in bureaucracy
([http://www.imdb.com/title/tt0088846/](http://www.imdb.com/title/tt0088846/)),
while App Engine is equally powerful but a lot simpler to use.

It's harder to make something simple and powerful than it is to make something
complex and powerful, so hats off to the Google engineers involved.

~~~
nostrademons
It took Google a _long_ time to get there - I remember checking out AppEngine
in 2007 and wondering why anyone would ever use it instead of EC2, and then
checking it out in 2009 and wondering how the hell to put together a working
app, and then checking it out in 2010 and giving up in frustration, and then
finally checking it out in 2012 and finding it was actually pretty useful for
prototypes.

~~~
johansch
The biggest disadvantage with Google from a global perspective: They don't
have a chinese-hosted edition, unlike Amazon/Microsoft/IBM.

I understand and can identify with the why...but still, most global businesses
want to target China.

------
vicwhiten
[http://hook.io/](http://hook.io/) lets you link a gist script to a webhook,
very similar. Open source & free.

~~~
christiangenco
Oh man, this is exactly what I've been looking for for a long time. What a
brilliantly simple implementation!

FYI: it looks like they have a really generous referral program[1], so post
your referral link (shameless example:
[https://hook.io/christiangenco?s](https://hook.io/christiangenco?s)) and I'll
tweet the developer to see if you can get retroactive credit.

1\. [https://hook.io/referrals](https://hook.io/referrals)

~~~
willcosgrove
[https://webscript.io](https://webscript.io) is also pretty awesome, if you're
willing to learn some Lua.

~~~
_Marak_
hook.io supports lua, along with eleven other programming languages.

------
logvol
[https://webtask.io/](https://webtask.io/)

Why the don't use Lambda: [https://medium.com/aws-activate-startup-
blog/sandboxing-code...](https://medium.com/aws-activate-startup-
blog/sandboxing-code-in-the-era-of-containers-294edb3a674#.ioqmc0ddn)

... hile we were at it, AWS announced AWS Lambda, which looked like a
potential remedy to our challenge. Upon further investigation, however, it
became clear AWS Lambda is centered on an asynchronous programming model that
did not quite meet our needs. The custom logic we run in Auth0 is an RPC
logic: it accepts inputs and must return outputs at low latency. Given the
asynchronous model of AWS Lambda, implementing such logic would require
polling for the results of the computation, which would adversely affect
latency...

------
gk1
(Full disclosure: I work with Domino.)

For some use cases, Domino's API endpoints[0] feature is an alternative,
especially if you want to run R or Python scripts.

[0]
[https://www.dominodatalab.com/benefits/web_services](https://www.dominodatalab.com/benefits/web_services)

------
jenkstom
Isn't most of the draw of Amazon Lambda that you can hook everything else into
a simple api hosting service? I doubt there are any direct competitors, at
least at that scale.

Here is a discussion:

[https://www.quora.com/Are-there-any-alternatives-to-
Amazon-L...](https://www.quora.com/Are-there-any-alternatives-to-Amazon-
Lambda)

~~~
ryan_sb
+1 one of the draws for Lambda is that it has easy integration with other AWS
tools (Kinesis, DynamoDB, SNS, even CloudFormation) and is really low-cost
since you only pay for execution time.

~~~
ches
And Amazon API Gateway, potentially the request routing layer for a
heterogenous set of Lamdba-backed endpoints. Seems like that may have been
particularly a service jenkstom was referring to. [https://aws.amazon.com/api-
gateway/](https://aws.amazon.com/api-gateway/)

------
akamel
[https://TaskMill.io](https://TaskMill.io) is in early open preview; free for
all

> TaskMill's extreme microservices OSS platform. Check-in your scripts to
> GitHub and we turn each into an HTTP endpoint. See how we are building a
> Docker-powered Open Cloud where we build on top of each other's scripts to
> Automate All The Things!

disclaimer; I am the founder of TaskMill

~~~
harrisonhjones
HN Hug of death? The website is down for me. I look forward to playing around
with it.

~~~
basit
Seems to be working fine

------
cdnsteve
I started trying to use Lambda and found a few immediate issues.

1) It does not work with anything inside VPC. EG: RDS Databases cannot be
used. This severely limits why you'd use this on AWS for larger apps.

2) Trying to get it working for a real app is a bit of a gun show. Debugging
was a pain, you cant really write any unit tests easily that I found. Local
development was confusing.

3) Lambda forces you to use old technology. Node .10x, Python 2x.

4) You're using code that will only ever work on AWS. If you don't like vendor
lock-in then look elsewhere.

If you don't need VPC access take a look at Heroku and background workers.
They scale independently from the front-end main app. No servers to manage,
just git push heroku master. You can write them in pretty much any language
you want. Heroku supports the latest stacks and languages.

~~~
KAdot
VPC support was introduced some weeks ago
[https://aws.amazon.com/it/blogs/aws/aws-lambda-update-
python...](https://aws.amazon.com/it/blogs/aws/aws-lambda-update-python-vpc-
increased-function-duration-scheduling-and-more/).

~~~
ryan_sb
Not quite, they announced it would exist: "This feature will be available
later this year." (from the post).

But when it is available, it'll be a _huge_ step ahead.

------
sapanbshah
We have been working on something like this as well using docker containers.
We call it Bakula its still in an early alpha phase.

The idea is that instead of writing to a particular API it listens for events
and mounts a filesystem. Then you just process files in the filesystem as your
events and delete them when they are done.

The code can be found on github at:
[https://github.com/immuta/bakula](https://github.com/immuta/bakula)

------
rakoo
Webscript ([https://www.webscript.io/](https://www.webscript.io/)) but it's
Lua only.

~~~
rowbot
I tried that once. If you are looking to invoke HTTP web services or SMTP mail
services from the web then it is good. ie., as online services not stored on
your system.

------
soccerdave
One cool use that we are using Lambda for is to destroy EBS snapshots past a
certain date. We tag snapshots with a 'retention_days' tag and then a Lambda
process kicks off daily and deletes the old snapshots. The great thing about
this is we can lock down the DeleteSnapshot api call so that none of our
instances have access to that call anymore.

------
zbjornson
Depending on your use case and how much startup time you can tolerate...

We need the ability to run 1,000s to 100,000s of ~3 second jobs as fast as
possible, but only sporadically (~100 times a day with our current customer
base). At that "low" frequency, can't justify the cost of keeping that many
dedicated servers up 24/7 to meet this intermittent need, and we need sub-
second startup times so we can't launch normal VMs on demand.

However, the cost of servers on Google Compute Engine (GCE) is actually
cheaper than lambda if you have big batches of jobs. The VMs could be launched
via their autoscaler or Dataflow, and jobs could be dispatched via Pub/Sub. If
you can secure enough preemptible GCE instances (which are of limited
availability), these are even cheaper. GCE VMs launch in about a minute,
compared to AWS's 3-7 minutes, so on-demand launching is actually doable for
some use cases as long as you don't mind paying the 10 minute minimum. This
also gives you access to huge resources (CPU and RAM) if needed.

Specifically, ~1.1 million 3300 ms 1536 mb lambda jobs cost us $90.04, and GCE
would be $50 on regular or $15 on preemptible GCE VMs for the same number of
jobs in the /same total execution time/. After requesting a Lambda quota of
100,000 concurrent jobs, we were only allowed 1,000 ("for now", they say) --
thus it takes an hour for that many jobs to complete, so GCE$ = (1 hr) * (cost
per vCPU/hr) * (1000 vCPUs). Note that we're using the max allowable memory on
Lambda because that ~linearly decreased our execution time, but we use an
average of 400 mb. My estimate also doesn't take into account the overhead
time that comes from launching lambda jobs that might be reduced via the home-
brew solution I described above.

Someone else mentioned the issue with Lambda only having 0.10 vintage node. We
have a somewhat complicated albeit elegant solution for communicating with a
portable node 4.x binary via IPC. If AWS ever gets to allowing specified node
versions, that would reduce our runtime marginally.

(BTW, I put in a feature request to GCE for a lambda-like service here:
[https://code.google.com/p/google-compute-
engine/issues/detai...](https://code.google.com/p/google-compute-
engine/issues/detail?id=253))

------
james33
We used to use Joyent Manta for the same purpose we are now using Lambda.
Joyent worked well, but Lambda works significantly better (speed-wise) and
significantly cheaper.

------
amelius
Newbie question: what does "Amazon Lambda" have to do with functional
programming? (Because the name suggests there is a connection).

~~~
TeeWEE
Actually not much. Its called lambdo because you can deploy functions to the
cloud, but those functions can be written in a non functional style

~~~
_delirium
That's the case for most uses of "lambda" in programming languages too. It
just means something like "anonymous function". I believe Lisp was the first
language to introduce lambda as a keyword, and that's how it uses it: (lambda
(x) ...) creates an anonymous function, but the body of the function doesn't
have to be written in a functional style. In fact the modern concept of
"functional style" didn't exist at the time.

------
im_dario
Inspired by Amazon Lambda I started working a few days ago in a similar
project: Nervio [0]

It is currently a very early alpha. Today I have planned to hide all NATS
references to have a very simple and agnostic API for components.

[0] [https://github.com/nervio/nervio/](https://github.com/nervio/nervio/)

------
hyperpallium
[http://stackhut.com/](http://stackhut.com/)

~~~
mands
Thanks for mentioning! Working on getting an OS X packaged app out this
weekend along with that Linux/Bash-as-a-service up!

------
microstash
APITools might help (depending on your use case). Haven't used them myself but
they gave a pretty good talk a couple months back.

[https://www.apitools.com](https://www.apitools.com)

------
kyleblarson
Anyone here have experience building workflows with SWF on top of lambda?

------
sabarn01
Azure WebJobs

------
austenallred
Why do you want an alternative? Not sure there are any as far as price goes.

------
rowbot
If you are looking to host a "PHP script" free, you should consider
000webhost. OR any shared host, the host you are using now.

