Live data from Hacker News

Serverless: slower and more expensive

einaregilsson.com

611–620 of 733 posts

Re: Serverless: slower and more expensive

#611

Earlier quoted context omitted.

The amount of infrastructure I have to setup/maintain to do all of that is, well, nothing. That is where the mental savings comes in. When I first started, I went from "never wrote an HTTP endpoint" to "wrote a secured HTTP endpoint that connects to my DB" in under 20 minutes. There is nothing for me to maintain. Setting up a new environment is a single CLI command. No futzing with build scripts. Everything will work…

>When I first started, I went from "never wrote an HTTP endpoint" to "wrote a secured HTTP endpoint that connects to my DB" in under 20 minutes. You could have had the exact same experience with Heroku or many other similar products that have been around for almost a decade and a half--it has nothing to do with serverless. >The sheer PITA of maintaining multiple environments and teaching build scripts what files to p…

> You could have had the exact same experience with Heroku or many other similar products that have been around for almost a decade and a half--it has nothing to do with serverless.

See below with Ander.

I don't have much infra, I don't need infra.

(I do in fact have a couple of VMs because I do have a service that is stateful.)

Not having to think about anything aside from "here is my code, it runs" is nice. Debugging consists of "did I write bad code?"

> It sounds like your architecture is far too complicated if you're managing all this by yourself. You don't need "a set of VMs" per environment if you're a small start up.

For the few things I run on VMs I still have to manage secrets so they can connect to the right DB. I also need to point my apps to the proper environment. The app being dev'd on my phone needs to point to the dev server with the dev DB secrets stored on it. Same goes for the website on localhost, or the website on the development server.

In an ideal world I'd have a script that created new environments on demand and it'd wire up all the build scripts automatically. Every developer would trivially get their own VM and could switch parts of the software (website, app, services) to point to various environments easily.

Why in the bloody world some build systems hard code only 2 options in is beyond me.

> If you believe that, you haven't been doing this long enough.

Sure old runtimes will be deprecated, but let's compare that to:

1. Setting up nginx 2. Setting up letsencrypt 3. Figuring out why my certs auto-renew but nginx doesn't pick them up (Turns out default setup doesn't actually force nginx to pick up the certs!) 4. Learning about various process management tools for JS to keep my services running 5. Setting up alerts for aforementioned daemons. 5b. Probably involves configuring outbound email. 6. Realizing something went horribly wrong in 5b and my inbox is now flooded with alerts. 7. Writing scripts to automate as much of the above as possible. 8. This legit happened, there was a security fix to SCP on Windows that changed how one of the command line parameters worked, breaking my deployment scripts when running them from Windows. 9. Does Google really want to charge me per decryption to store my API keys in their cloud API key storage service? They have to make money, but ouch. 10. Security updates not just for code, but for the VM images.

Like, I get it, if my entire job is back-end development. But I want to write some functions that maybe hit double digit millisecond run times and throw away all their state after.

Firebase says "here, export some functions, we'll give you an HTTPS URL you can call them at."

That is the sum total of my relationship with the tooling. "Run my code." "Sure."

About the only other thing that works that simply is a headphone jack, and those are going away.

Re: Serverless: slower and more expensive

#612

Earlier quoted context omitted.

With Firebase if I need a new env I just type 1 command and get it. With VMs I have the joy of managing my own keys. VMs need security patches, updates, and I have to maintain images. I have to think . It is hard to explain how simple firebase functions are. There is literally no mental overhead. There is no worrying. There is nothing to maintain or think about, no settings up quotas or managing what machine somethin…

Ah ok so you're 100% serverless so functions are saving you all the headaches of running your own infra? That makes sense. It sounded like the time to add an endpoint was your main criteria and just seemed strange.

The time saved is time thinking about doing anything else other than "I want to write code". :)

Re: Serverless: slower and more expensive

#613

Earlier quoted context omitted.

>When I first started, I went from "never wrote an HTTP endpoint" to "wrote a secured HTTP endpoint that connects to my DB" in under 20 minutes. You could have had the exact same experience with Heroku or many other similar products that have been around for almost a decade and a half--it has nothing to do with serverless. >The sheer PITA of maintaining multiple environments and teaching build scripts what files to p…

> You could have had the exact same experience with Heroku or many other similar products that have been around for almost a decade and a half--it has nothing to do with serverless. See below with Ander. I don't have much infra, I don't need infra. (I do in fact have a couple of VMs because I do have a service that is stateful.) Not having to think about anything aside from "here is my code, it runs" is nice. Debuggi…

Again, none of this has anything to do with serverless architecture vs non-serverless architecture. There are many PaaS providers that would eliminate all of your complaints that aren't "serverless". They just manage the server for you. But you still write a normal app that you can easily run locally or port anywhere you want.

If you decide you don't like the service, you're app isn't tied to a proprietary API or architecture.

And you don't need to manage additional VMs for stateful services.

Re: Serverless: slower and more expensive

#614

This is how a conversation with a colleague who were enthusiastic about Serverless, and who's company was mostly on Java/JVM stack went: Colleague: Lambda is awesome, we can scale down to zero and lower costs! We love it! We use cool tech!! Me: What did you do about JVM warm up? Colleague: We solved it by having a keepalive daemon which pings the service to keep it always warmed up. ... Me thinking: Uhh, but what abo…

Keep-Alive daemon doesn’t work during scale up. If you go from 1 simultaneous request to 3, it will have to slowly spin up those 2 lambda’s in response to a user a request.

Re: Serverless: slower and more expensive

#615
post #5

They're doing over 100rps if they're doing 10M requests a day. That's not a good use case for Lambda. If you're going to be that heavily utilized it makes more sense to run your API on EC2 or ECS/Fargate/etc. Lambda is a good use case for when you have lots of not-often-used APIs. Lambda is a great solution for an API that's called a few times a day. It's also great for when you're first starting out and don't know w…

I've always found Troy Hunt's tech stack of haveibeenpwned.com interesting. The API does 5M requests a day with Azure Functions and Cloudflare caching. Ultimately only costing him 2.6c per day. https://www.troyhunt.com/serverless-to-the-max-doing-big-thi...

It’s highly cacheable.

Re: Serverless: slower and more expensive

#616

Earlier quoted context omitted.

Docker can also be serverless and gets rid of all the limitations of lambda - Fargate.

I tried using google cloud run, with a rust web server. I think google only counts request processing time and rounds up to the nearest 100ms. All i had to do was provide a container with a web service that reads a environment variable to listen to a specific port.

I am considering using g cloud run for my next project. How did you like it ?

Re: Serverless: slower and more expensive

#617

Earlier quoted context omitted.

So, to summarize, you should: 1. not use the programming language that works best for your problem, but the programming language that works best with your orchestration system 2. lock yourself into managed services wherever possible 3. choose your api design style based on your orchestration system instead of your application. 4. Use a specific frontend rpc library because why not. ... I've hacked a few lambdas toget…

> I've hacked a few lambdas together but never dug deep Then why comment? You clearly don't understand the use-case that AWS fits. I've had jobs that took 18 hours to run on single machine finish in 12 minutes on Lambda. I could run that process 4 times a month and still stay within AWS's free tier limits. For the right workloads it is 100% worth realigning your code to fit the stack.

>I've had jobs that took 18 hours to run on single machine finish in 12 minutes on Lambda. I could run that process 4 times a month and still stay within AWS's free tier limits.

Ok I'll bite. What takes 18 hours to run on a single machine but finishes in 12 minutes on Lambda.

Re: Serverless: slower and more expensive

#618
post #50

PSA: porting an existing application one-to-one to serverless almost never goes as expected. Couple of points that stand out from the article: 1. Don’t use .NET, it has terrible startup time. Lambda is all about zero-cost horizontal scaling, but that doesn’t work if your runtime takes 100 ms+ to initialize. The only valid options for performance sensitive functions are JS, Python and Go. 2. Use managed services whene…

As general rules these sound great at first sight, but don’t really address the main culprit from TFA - like for like API Gateway costs a lot more to process n number of requests.

Re: Serverless: slower and more expensive

#619
post #574

Earlier quoted context omitted.

This seems more applicable to consumer products, not business / cloud services, though I imagine I might be overlooking something.

That's a fair observation. I do go back and forth but in the end it's enough to swing me, in the principle-of-least-regret way.

So what do you use as the backend for now?

Re: Serverless: slower and more expensive

#620
post #609

Earlier quoted context omitted.

I am similarly, reading this list and wondering

One day people will rediscover installing a Linux box with an Apache server and call it novelty.

One day people will realise there is a Linux box behind Lambdas and you can run your own box in a basement a lot cheaper
Post reply on HN