Live data from Hacker News

Going Serverless: Migrating an Express App to AWS API Gateway and AWS Lambda

aws.amazon.com

21–30 of 140 posts

Re: Going Serverless: Migrating an Express App to AWS API Gateway and AWS Lambda

#21
So, Apigee had this exact service. They did something pretty cool, it seems they implemented nearly all (!) of the Nodejs APIs in a JVM variant, then designed them to run on demand [0].

I actually ported an Express app to Apigee's service, to run webhooks and ETL. It worked flawlessly. The one downside was that they kept their own internal registry of compatible packages and there was no way they could keep up with the Nodejs ecosystem even with few holes in their API.

I still have a ton of hope that Google does something smart with this, I actually wanted to pay Apigee for their service, but their pricing started at an Enterprise tier and none of my projects made it that far.... yet.

Something to think about.

[0]: http://docs.apigee.com/api-services/content/overview-nodejs-...

Re: Going Serverless: Migrating an Express App to AWS API Gateway and AWS Lambda

#22
post #3

Listen folks - it's still a fantasy. Latency is still 5s on many requests = no deal. This has been going on for years. Would someone form AMZ please stand up? I suggest that the latency is 5s for the 'first call', then, subsequent calls are fast - and if you don't use your lambda for a minute or so, it goes back to having latency. I suggest maybe this has something to do with loading it into memory when it's used? Th…

If you are serving high traffic then what's the problem?

If your product has only occasional use then you trade cost for latency; spin up an ec2 instance if your request times exceed a few minutes call

Re: Going Serverless: Migrating an Express App to AWS API Gateway and AWS Lambda

#23
post #13

Earlier quoted context omitted.

I measured the actual latency over the weekend [0] [1] Bare ec2: 15ms Lambda via API Gateway: 276ms [0]: http://prerender.cloud/lambda-latency [1]: https://news.ycombinator.com/item?id=12678011

Thanks for the data points. I understand that Lambdas are 'relatively quick' when they are 'hot' - which is my crude metaphor for 'up and running'. The issue is, if the Lambda has not been in use for some time (seconds, minutes?), then the 'first call' can have quite a bit of latency - often up to 5 seconds - which killed it for us. There is no way we could reasonably deploy a service wherein customer would have to w…

Actually I was making the point that they are not "relatively quick" even when hot: close to 300ms, almost entirely due to the API Gateway. (I even measured API Gateway on top of bare ec2 and the same penalty applies).

Lambda itself is fairly quick (~75ms), but API Gateway needs some work.

Re: Going Serverless: Migrating an Express App to AWS API Gateway and AWS Lambda

#24

Earlier quoted context omitted.

"If that's what you need...you need a server." We want micro-services that are available as we need them, at any scale, and we never want to deal with a 'server' again. "You break the entire model of an oversubscribed multi-tenant container system" - we don't care that much about how it's implemented, or what underlying model is used, as long as it is secure, robust, and reliable.

> We want micro-services that are available as we need them, at any scale, and we never want to deal with a 'server' again. I'm going to argue that's currently unrealistic, but if you want someone to build something, tell them its impossible. Clearly its not easy to build a system that'll run code on demand as fast as bare metal; accept the trade offs with the understanding why you're making them.

What I'm asking for is definitely within grasp of Amazon's team :) they just need to get there.

Moreover, it's a rather fundamental opportunity for them: Lambda's are a form of 'container' and they are exactly what so many of us want. The deal-breaker for us was the latency issue.

Amazon is a pretty smart company, and it's a big opportunity, I'll bet they eventually get this sorted out.

Re: Going Serverless: Migrating an Express App to AWS API Gateway and AWS Lambda

#25
post #2

Can you achieve competitive latency for web pages using API Gateway and Lambda?

I was curious about the same thing and setup a jvm lambda to test. The setup was served through API gateway, connected to a postgres RDS, selected a couple records from a single database table and returned them as json, and deployed in us-west.

From the west coast, I'm getting between 150ms and 300ms response times for most requests, but it does jump around quite a bit, with occasional requests taking 500ms-800ms to complete.

A lot of the variability seems to be coming from execution time of the lambda itself, which would probably be because of the connection to RDS? I'm using HikariCP so the connection is pooled but maybe something like dynamo would be better.

So latency is all over the place, but generally under half a second.

Re: Going Serverless: Migrating an Express App to AWS API Gateway and AWS Lambda

#26
post #11

I love lambda's, but api gateway was far from mature the last time I used it (6 months ago). Unless they have made serious updates to the deployment workflow, feature set, and documentation I would not recommend building your products on it.

The "0 to 1" workflow right out of AWS could not be easier, they have an in-browser code editor with a hello world already written for you.

But that workflow doesn't make sense for real dev teams. So there's https://github.com/serverless/serverless . It's driven by a yaml file and is intuitive.

The only thing I'm bothered by is lack of environment variables (have to hard code them) and terrible API Gateway latency - see https://news.ycombinator.com/item?id=12681926 further down the page

Re: Going Serverless: Migrating an Express App to AWS API Gateway and AWS Lambda

#27
post #11

I love lambda's, but api gateway was far from mature the last time I used it (6 months ago). Unless they have made serious updates to the deployment workflow, feature set, and documentation I would not recommend building your products on it.

I'm in the same boat. I have 4 microscervices set up with API Gateway + Lambda and now actively guide people away from API Gateway.

Re: Going Serverless: Migrating an Express App to AWS API Gateway and AWS Lambda

#30
post #16

I've recently deployed a small Flask based micro-service for an internal tool leveraging Zappa[0] to deploy it to Lambda/API Gateway. Overall it's been a really smooth experience. I'm looking forward to using it again. [0] https://github.com/Miserlou/Zappa

Is there a big overhead in terms of latency? If I understand correctly you essentially have to start a server for each request.
Post reply on HN