Live data from Hacker News

Serverless Performance: Cloudflare Workers, Lambda and LambdaEdge

blog.cloudflare.com

11–20 of 65 posts

Re: Serverless Performance: Cloudflare Workers, Lambda and LambdaEdge

#12
post #5

The value of any function-as-a-service is the ecosystem within which it sits. Pretty much all of them are the same: upload your code, we will run it. The value comes from 1) What can trigger that code to run and 2) What services that code can interact with. And on those two points, AWS still wins hands down. They have by far the most possible triggers for Lambda, and they have by far the most services that Lambda can…

Yes, that's how Amazon creates lock-in. But it depends what you're doing with it right? If you are looking to run code based on a SQS event, yes you have to use a Lambda. If you are looking to execute code when something visits a URL you have more options.

Triggering Lambdas based on SQS events is new - it was just introduced at the end of June of this year.(https://aws.amazon.com/blogs/aws/aws-lambda-adds-amazon-simp...). For the past 14 years you've had to poll for SQS messages.

If you are referring to SNS, you've always been able to send SNS messages to HTTP endpoints. (https://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp....)

Re: Serverless Performance: Cloudflare Workers, Lambda and LambdaEdge

#13
post #11

I wish Cloudflare would offer some kind of key-value store with Workers, something like Google Cloud Memorystore but globally distributed in all of their PoPs - even if it's really limited like 32 MB RAM.

Would you like to be able to write to it from your Worker, or only read from it? Can you tell us more about your use case?

Feel free to email zack [at] cloudflare.com directly if you like.

Re: Serverless Performance: Cloudflare Workers, Lambda and LambdaEdge

#14
post #5

The value of any function-as-a-service is the ecosystem within which it sits. Pretty much all of them are the same: upload your code, we will run it. The value comes from 1) What can trigger that code to run and 2) What services that code can interact with. And on those two points, AWS still wins hands down. They have by far the most possible triggers for Lambda, and they have by far the most services that Lambda can…

Yes, that's how Amazon creates lock-in. But it depends what you're doing with it right? If you are looking to run code based on a SQS event, yes you have to use a Lambda. If you are looking to execute code when something visits a URL you have more options.

> Yes, that's how Amazon creates lock-in.

That is the cynical way to look at it. It also creates value because it lets you do more with what you already have.

> If you are looking to execute code when something visits a URL you have more options.

Sure, but unless that code works in isolation, it probably needs at the very least access to some sort of data store.

Re: Serverless Performance: Cloudflare Workers, Lambda and LambdaEdge

#16

Does Cloudflare have a free DB of sorts, like Amazon's DynamoDB? Or can I query Amazon's DynamoDB from the worker?

That's something we're working on at Cloudflare. You can query any database which has an HTTP interface though right now. It looks like Dynamo has one: https://docs.aws.amazon.com/amazondynamodb/latest/developerg...

But you also have a bunch of other options like:

- https://restdb.io/

- https://firebase.google.com/docs/reference/rest/database/

- http://couchdb.apache.org/

Re: Serverless Performance: Cloudflare Workers, Lambda and LambdaEdge

#17
As the architect of Workers I was obviously pretty happy with Zack's results in general. But, I'm not happy with the tail latency (99th percentile), even if it beats the competition. I suspect this has to do with GC pauses. The solution may be to proactively run GC in a background thread between requests. For high-traffic workers that are always processing requests, we could load multiple instances of the worker and alternate between them.

BTW, if you're into modern C++ and this kind of work interests you, please e-mail me at kenton at cloudflare.com. We're hiring!

Re: Serverless Performance: Cloudflare Workers, Lambda and LambdaEdge

#18

Does Cloudflare have a free DB of sorts, like Amazon's DynamoDB? Or can I query Amazon's DynamoDB from the worker?

I've written a few blog posts about using FaunaDB from FaaS functions, the steps should be the same for any FaaS provider:

1) Provision a (free) connection secret from fauna.com

2) Import the FaunaDB driver (npm install faunadb)

3) Create a client object using your connection secret.

After that you are using FaunaDB, which is purely pay-as-you go, with ACID transactions, joins, indexes, etc.

It would be simple to write a tutorial like this for Cloudflare. Hello world on Azure functions: https://blog.fauna.com/azure-functions-with-serverless-node-... and on Lambda: https://blog.fauna.com/serverless-cloud-database

Re: Serverless Performance: Cloudflare Workers, Lambda and LambdaEdge

#19
post #18

Does Cloudflare have a free DB of sorts, like Amazon's DynamoDB? Or can I query Amazon's DynamoDB from the worker?

I've written a few blog posts about using FaunaDB from FaaS functions, the steps should be the same for any FaaS provider: 1) Provision a (free) connection secret from fauna.com 2) Import the FaunaDB driver (npm install faunadb) 3) Create a client object using your connection secret. After that you are using FaunaDB, which is purely pay-as-you go, with ACID transactions, joins, indexes, etc. It would be simple to wri…

That would be great, please do!

Re: Serverless Performance: Cloudflare Workers, Lambda and LambdaEdge

#20

Does Cloudflare have a free DB of sorts, like Amazon's DynamoDB? Or can I query Amazon's DynamoDB from the worker?

Building out storage is my current focus. The challenge is that we want to build something that actually utilizes out network of 151 locations today, 1000's of locations in the future. If your application has users on Mars (or, New Zealand), you should be able to store their data at the Cloudflare location on Mars (or, New Zealand) so that they can get to it with minimal latency.

PS. If you're a storage expert and building a hyper-distributed storage system interests you, e-mail me at kenton at cloudflare. We're hiring.

Post reply on HN