
Introducing Apex – Serverless Architecture with AWS Lambda - johanbrook
https://medium.com/@tjholowaychuk/introducing-apex-800824ffaa70
======
skywhopper
I'm curious if anyone has deployed a real app at any scale on Lambda/API
Gateway. So far in my experience, the default limits and throughput are far
lower than would be remotely useful for a moderately busy webapp. And to hit
those rates would be outrageously expensive.

That may improve over time. But even more than that "serverless" is
misleading. True, you don't have to personally manage the servers that are
running your code, but that means that your operations team is actually inside
Amazon. They have economies of scale, but that means they also don't always
notice when one of their servers isn't performing up to par. More than once
we've had to ask our support reps to get Lambda instances behind the scene
restarted. At that point I start to wonder what the point is at all.

~~~
taitems
The guys at [http://acloud.guru](http://acloud.guru) are running their
platform on Lambda/Firebase, and have given a few talks about how they've
managed to achieve it. Disclaimer: I know a founder of theirs.

~~~
nickjj
They have written a blog post that goes into more detail on how they piece
together various components with Lambda: [https://read.acloud.guru/serverless-
the-future-of-software-a...](https://read.acloud.guru/serverless-the-future-
of-software-architecture-d4473ffed864#.thhfdvbc9)

I'm pretty sure they have another post coming in the near future too.

I am impressed by how fast they built their platform given the size of their
dev team. We (I'm a course author there, not developer) also use Lambda for
custom slack bots too.

------
iamleppert
I tried to use and love lambda, spending a lot of time making my use-case work
for their poor development and deployment environment (a zip file, really??).
In the end, I had to abandon the effort.

They only allow a certain fixed execution time and 500 mb of temp space, max.
And they won't raise these limits.

During testing I noticed that frequently I would have the same contents of
empirical storage (/tmp) -- i.e. i'd be running on the same host.

I have a sneaking suspicion that the entire purpose of lambda is to resell
capacity on hosts that aren't busy -- but could be -- thus the low CPU time
limits and storage spaces. I'm sure someone would not notice 500 MB or 5
minutes of CPU time vampired on their less busy, not monitored hosts from time
to time. And if the _real_ user does need the capacity, they can just kill the
process, which had happened many times in my testing (process would be killed
or die for no reason).

Sounds great and amazing in theory, but execution is horrible and unusable
except as a toy.

~~~
tjholowaychuk
I had a similar feeling when I first tried it. The UX is really bad, I'll give
you that! For my current use-cases though I think it'll be just fine.

That's interesting about the random kills, I'll keep an eye out for that, good
to know. Interesting theory though haha, wouldn't surprise me too much.

------
encoderer
At Cronitor we've just finished building out lambda infrastructure for a fan-
out where I would otherwise use a worker application and Supervisord.

Lambda has a lot of strengths, and it gives you solid primitives like
immutable versions, version aliases/pointers and stateless functions.

The problem I had was that it didn't give me any more than that. Here are just
a few of the things we had figure out and then build ourselves:

1\. The development workflow. How can I get a REPL workflow going that doesn't
make me go crazy.

2\. Deploys and Rollbacks. How can we safely deploy and rollback, especially
in cases where you have the same lambda function in multiple regions and each
region is at a different published version (because the version number is
monotonically incrementing)

3\. Permissions and Policies. The broad strokes are clear. But you want your
S3 bucket or SNS topic to trigger lambda? Get ready to spend an hour trying to
figure out what you've done wrong and what's missing from the vague
directions. Hope you get that REPL flow solid first.

In the end, we built several scripts (create_build, publish_version,
promote_to_prod, etc) and we use these directly during development and from a
Fabric-based deploy script. When I have time I plan to release this tooling
open-source.

If I had to do it all over again, I wouldn't. And I wouldn't use Apex (at
least not yet). I would just use a t2.small instances with a simple worker.

------
MCRed
I love the idea of developers working on code, and not infrastructure, and so
I love open source projects that solve this problem (by automating
infrastructure).

But I will never support anything that locks me into a particular vendor.

There are many reasons, from geopolitical to economic, that any open source
infrastructure effort should be vendor neutral.

~~~
wahnfrieden
Would be nice to see something like Apex that can work on Lambda or within
some kind of deployable service, so that the environment it actually ran on
was abstracted, avoiding vendor lock-in. I haven't seen any projects yet that
try to make the Lambda interface portable though.

------
zitterbewegung
There is a stream and batch processing framework called Apache Apex. Might be
a good idea to change the name. See
[https://www.datatorrent.com/apex/](https://www.datatorrent.com/apex/)

~~~
technoblue
Salesforce also has a language called Apex
[https://developer.salesforce.com/page/Apex](https://developer.salesforce.com/page/Apex)

~~~
jacques_chester
And Oracle, god make their sandals rot, have "Application Express", often
abbreviated to ApEx.

~~~
orclapex
The product itself ([http://apex.oracle.com](http://apex.oracle.com) and
[http://apex.oracle.com/ut/](http://apex.oracle.com/ut/)) isn't bad: it's
tailored toward citizen developers versed in the Oracle DB.

Off topic: if you're reading this, Vlad my boy, I will think about sending you
an email at some point. Because we all know how you love emails.

~~~
jacques_chester
It's ... a thing. I don't miss it.

------
iamflimflam1
There's some limitations with both lambda and the API gateway that you need
the be aware of -

API gateway has a fixed timeout of 10 seconds that you can't currently extend.
Should be fine for most use cases, but something to be aware of if you have
any functions that will take longer.

Lambda functions cannot return binary data.

~~~
bkokoszka
Another big limitation is that you currently can't run lambdas in a VPC, so
using Lambda with RDS is pretty much off the table if you don't want your
database to be open to the world.

------
gingerlime
Looks great, and the discussion on HN is always helpful to find other related
projects.

I've just finished prototyping a A/B testing backend running over Lambda / API
Gateway. I think I bumped into some of the rough edges others are mentioning.

What troubled me the most however is how difficult it is to share / open-
source the code for such a project. There are no environment variable support,
so to configure things you have to embed them in code. No way to easily
package something that users can just run a few simple commands and get up and
running (I think having an AWS CLI + keys already set up is a pretty hefty
upfront requirement). So you end up with a huge readme or a blog post just to
explain how to set up all the moving parts. A small mistake anywhere along the
process and this thing isn't working any more...

I hope tools like Apex can also solve this use-case. Something akin to the
heroku / digitalocean button would be truly awesome.

------
est
Looks like "serverless" is the new buzz word for App Engine or Heroku?

~~~
jchrisa
Which is too bad because there is a lot more interesting things you could do
if you really didn't need the cloud, and connected apps could run client only.

~~~
est
Especially after VoLTE, all 4G data are IP based and even voice data are
actuall controllable in Application Processor, it's basically SIP+RTP on a
port like 5060. Someone need to develop a VoLTE p2p.

------
brightball
I think of Lambda like I think of database triggers. It's a great solution for
the specific thing that it's built for but people have a tendency to go very
overboard with it.

Built for: Triggering events when something happens within AWS Not built for:
Replacing all of your servers

I once knew a guy who was very into Oracle and wanted to server up HTML from
stored procedures. This strikes me as that line of thinking.

~~~
Swannie
Serving up HTML from Stored Procedures was a thing back in the late 90's/early
2000's as enterprise vendors made the shift to web apps.

In fact quite a popular thing for client-server app's where the server was
built in PL/SQL, and some clients just needed reports.

I agree, AWS Lambda is a hammer. Just like everyone in enterprise software
jumped at J2EE and Enterprise Java Beans back in early 2000's, and "did it
wrong", I expect the same to happen here.

I just wish I know of a decent Open Source project doing similar things in a
super-light-weight fashion - ideally in Python.

~~~
brightball
Well, if you look at Lambda as a simple event notification system that
integrates with AWS your closest equivalent is PHP.

PHP isn't integrated with the AWS stack, but you could drop a terabyte of code
on a 256mb VM and it would all run when called. Scales down really well, which
is great for housing little one off scripts to receive web hooks at minimum
cost, utility servers, etc. It's not sexy, but very effective.

I'd imagine you could do the same type of thing with Python in a CGI mode or
something along those lines, but most other languages purposed for web stuff
tend to need to load a lot of libraries at runtime to operate that way.

------
kapilvt
[https://github.com/garnaat/kappa](https://github.com/garnaat/kappa) targets
the same feature set, and has more functionality afaics, albeit perhaps
slightly different. It has more sources to bind lambda to, and takes care of
more of the drudgery (iam, permissions, etc). It doesn't do the nodejs shim
for go.

------
proc0
Am I the only that can't fucking scroll down on this site. I didn't know this
was so annoying.

