Live data from Hacker News

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

aws.amazon.com

131–140 of 140 posts

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

#131

I hate the term serverless. It involves a server. AWS Lambda is a service bound to a port therefore a server. It runs user defined functions, true. But it is a server.

Me, too. And "driverless cars," also.

There is a driver! It's just in software! The car's still got something driving it. It's just not a person!

People tell me, "Dude, that's pedantic. Clearly what people mean when they say 'driverless cars' isn't that there's literally nothing driving it. They mean that having people driving cars has a lot of downsides and having the benefits of cars available without having an in-person driver opens up a lot of opportunities and frees us from personally having to drive ourselves."

I hate it when they tell me that.

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

#132
post #39
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

I love zappa, there's also chalice: https://github.com/awslabs/chalice

Have you used both? How would you compare/contrast them?

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

#133
post #13
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…

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

No way you're getting 15 ms on a TLS connection over the internet. I've set up similar pings with API Gateway and API Gateway -> Lambda, and it seems with the APIGW the TLS connection is the most expensive part. On an established connection I've seen 10 ms overhead which is not great but worth the value in some cases.

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

#134

I hate the term serverless. It involves a server. AWS Lambda is a service bound to a port therefore a server. It runs user defined functions, true. But it is a server.

Me, too. And "driverless cars," also. There is a driver! It's just in software! The car's still got something driving it. It's just not a person! People tell me, "Dude, that's pedantic. Clearly what people mean when they say 'driverless cars' isn't that there's literally nothing driving it. They mean that having people driving cars has a lot of downsides and having the benefits of cars available without having an in-…

Autonomous car could be a better term.

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

#135

Earlier quoted context omitted.

Me, too. And "driverless cars," also. There is a driver! It's just in software! The car's still got something driving it. It's just not a person! People tell me, "Dude, that's pedantic. Clearly what people mean when they say 'driverless cars' isn't that there's literally nothing driving it. They mean that having people driving cars has a lot of downsides and having the benefits of cars available without having an in-…

Autonomous car could be a better term.

You're right. There is a clear and accurate alternative in this case. What about for a serverless architecture?

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

#136
post #23

Earlier quoted context omitted.

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.

Yeah, I tend to agree, I just didn't want to be a total jerkoff on the thread.

250ms we can live with for many things, but not 5x.

But yes - it should be under 50ms at all times I think for people to start taking it seriously.

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

#137

Earlier quoted context omitted.

Ok, I want a 2 pronged approach: 1) A NoSQL DB for the main data providing replication and scalability(e.g. Cassandra or DynamoDB). 2) Another DB for quick access and transient Data where replication is not so important, e.g. storing the session cookie. Relational vs Non-relational would not be an issue since I'm only storing very little data here and want fast access and minimize costs(in DynamoDB you still have to…

How much data are you going to have, and of what format? Do you actually need NoSQL here?

I'm doing a social networking site, so I don't know how much data I will end up with. My reasoning was as follows:

1) The data model is rather simple, basically one table with the user data(name, location, age, etc...) and some images. So it shouldn't be too difficult to do this with NoSql as opposed to SQL. Yes, simpler with SQL but not significantly so.

2) If I ever need to scale, I'd rather make the right choice from the beginning(NoSQL) so as not to need a migration later.

3) In any case NoSQL would be a learning experience for me, so another plus.

If there is a mistake in my reasoning I would be grateful for any one pointing it out.

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

#138

Earlier quoted context omitted.

Just curious, what would be the major drawbacks of not using relational here? My understanding is that AWS is pushing Dynamo quite a bit and it seems cheaper, so if they're only needing to query off of session id and maybe user id, shouldn't that be sufficient?

Relational is super handy. Very easy to report on and do various things down the road. If all he needed was session id, sure, NoSQL is more or less the same. But what about when he adds other fields that are related? Say customer address or reports or .... His life may very well be easier with relational. You should generally start relational. Then branch out if you are hitting the brick walls of relational. People u…

> You should generally start relational.

I don't know if it is that easy to scale once you realize that the demand is growing, see my other reply here:

https://news.ycombinator.com/item?id=12692234

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

#139
post #71

Earlier quoted context omitted.

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

You could have certain requests that don't come that often, even on a high traffic site. And if you don't know for how long lambdas stay hot, how are you supposed to time it? Even a call every few minutes may not be enough to keep them hot.

Ah, I see. Perhaps that would be a reason to keep an ec2 instance spun up to host the functionality that must always have latency < warmup+runtime? Surely suboptimal. This makes me consider running a cron job to poke timing critical lambda workflows every few minutes...which to me imply writing my functions in such away as to expect this "heartbeat" and act accordingly...and that just feels plain icky...

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

#140

Earlier quoted context omitted.

Tim, when are we getting Python 3 support on Lambda? Being stuck on 2.7 has been the greatest source of issues and the #1 problem we have with Lambda. If Google/Microsoft came out today with Python 3 support in their Lambda competitor, we'd move in an instant.

I'm in the same boat. We're developing a new product with no real reason to stay on Python 2, besides Lambda. Python 3 support would make my life so much easier.

Yep, I hear about the lack of Python3 all the time, and I know our Python users are waiting for it. On the roadmap, and partially complete, but competing with some other language work at the moment.
Post reply on HN