Live data from Hacker News

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

aws.amazon.com

51–60 of 140 posts

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

#51

Earlier quoted context omitted.

> it refers to the fact that your CODE (applications and software in general) should not be AWARE of being executed on a physical or virtual machine. With the exception of para-virtualised device drivers, what code is ever aware of being executed on physical or virtual machines?

C'mon now, you know what was meant...

No, I honestly don't, using that definition.

AWS Lambda and similar services have literally nothing to do with hardware vs software.

They're about running a function in response to an event on someone else's stack, almost like the `map` part of a `map-reduce`, if the input was considered to be distinct events/objects.

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

#52
post #6

Earlier quoted context omitted.

stands up https://www.youtube.com/watch?v=eJO5HU_7_1w You're describing container re-use which is documented in the page here: http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduct... You could have cloud watch run the function every minute? Again, that won't guarantee that your function will be "hot". But it's a quick hack to potentially reduce the frequency of your slow initial start. That said customer feed…

Thanks for your response. I checked out the doc and didn't see any reference to latency or how to mitigate it, perhaps I'm missing something? Listen - I'm a massive fan of AWS. We use some core services and are very happy. I know you listen to customers - but I suggest that Lambda was probably designed for specific kind of services (maybe IT, admin, batch processing etc.) - I'm going to fathom that maybe 'people runn…

Not having PCI compliance in Lambdas are a huge drawback that keeps us on EC2s despite having a large amount of our webservice now on Lambda. API Gateway latency would be a big problem if we were doing a high perf webapp. Fix those 2 problems and we get to do serverless all the way.

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

#53

I'm always surprised at the lack of discussion around database connection reuse with AWS Lambda. It's a pretty big deal that every single API call requires a new database connection. The only solutions I've seen so far are to run a separate app to interface with the database, or moving the connection outside of the handler (which still has issues). Am I missing something or is everyone just really happy to use Dynamo…

If you are creating connections outside of handler, it gets cached by Lambda between invocations. However you'll need to tune your database settings or you'll run out of connections on traffic spikes. Depends on your pattern of usage. Also cold start of lambda in VPC could take around 15 seconds https://www.reddit.com/r/aws/comments/49l91l/lambda_function... https://forums.aws.amazon.com/thread.jspa?messageID=735318&t... My experience with DynamoDb was much smoother than with Postgres RDS in VPC

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

#55
post #54

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.

Isn't it more of a cluster rather than a server

A cluster of? servers. Again, server. server, server, server. Repeat with me: server.

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

#56

Earlier quoted context omitted.

C'mon now, you know what was meant...

No, I honestly don't, using that definition. AWS Lambda and similar services have literally nothing to do with hardware vs software. They're about running a function in response to an event on someone else's stack, almost like the `map` part of a `map-reduce`, if the input was considered to be distinct events/objects.

Or just RPC writ large.

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

#57
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…

You break the entire model of an oversubscribed multi-tenant container system if you want every lambda hot all the time. If that's what you need...you need a server.

Keeping a Lambda container in memory is probably not going to take more than 500MB of RAM. Paying a monthly minimum fee per lambda per machine per month to keep it in RAM should be an option. It would still be far cheaper than a real server.

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

#58
post #48
post #44

Earlier quoted context omitted.

How exactly have you been doing that? It would be a cool blog post if you had the time. I've been thinking about really high volume applications that connect to haproxy instances that do DB load balancing but even that has it's own set of initial latency issues. I haven't fully figured out that architecture. In python in particular I'd really love to know how to setup the connection reuse.

Check out the handler source code in Zappa for an example of a pattern like that. Similarly, if you use Zappa to deploy your application, if you create your database connection when the application loads, it'll just work. Stop by the Zappa slack if you want to explore this in more detail! https://slack.zappa.io It could always use more investigation, but there are quite a few Zappa users at extremely high loads now w…

This project looks super interesting. Thanks for sharing it! Now I want to come up with a use case to test it out over the next few days, maybe something for the Echo? I joined your Slack, we'll see where this takes us :)

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

#59
post #54

Earlier quoted context omitted.

Isn't it more of a cluster rather than a server

A cluster of? servers. Again, server. server, server, server. Repeat with me: server.

It's just semantics, point is, you don't have to worry about spinning up servers, provisioning them, or maintaining them; just write code.
Post reply on HN