DEV Community

loading...

Discussion on: DISCUSS: JavaScript just DIED! What language should replace it?

Collapse
higginsrob profile image
Rob Higgins

Obvious choice is python as there are already mature web libraries like flask, but my new favorite stack is using lambdas like a normal server. If you go that route you can write them in Java, Go, PowerShell, Node. js, C#, Python, and Ruby. I'm working on a project right now, I wrote the server in node as an (aws) api gateway lambda proxy, without using any libraries. I eventually decided to rewrite it as a node/express server, and it's kind-of badass. The most cost efficient option I can imagine while also effortlessly scaling to meet extremely high demand. Lambda can scale up to 1000 concurrent connections, in theory you would need 125 8 core ec2 boxes to match the "multi-threaded" processing power. That's a pretty bloated estimate as there are other variables that will slow down lambdas, but you get the idea. The second reason I love this system is deployment bliss. It's fast to launch stacks with cloudformation when the heaviest thing it has to do is update a single lambda. This means you can build continuous delivery/integration automation into your dev tooling (github actions), you can quickly launch "staging" stacks, removing the need for a blue/green type system. Updates are immediate and rolling, meaning you don't have to launch the new task before stopping the old task to achieve zero downtime. Ok I'm done geeking out on my new serverless server design.

Collapse
sharpninja profile image
The Sharp Ninja

If your API scales up to 1000 instances you are going to have a heart attack when the bill shows up.

Collapse
higginsrob profile image
Rob Higgins

That's not how lambda works. Lambda is the least expensive infrastructure in my org.

Requests $0.20 per 1M requests
Duration $0.0000166667 for every GB-second

Thread Thread
sharpninja profile image
The Sharp Ninja

What API gateway are you using?

Thread Thread
higginsrob profile image
Rob Higgins

SAM-cli (optional) -> aws cloudformation (optional) -> (aws) api gateway -> lambda proxy

Collapse
jffrydsr profile image
Jeffrey Desir

Python is half as elegant as ruby with twice the overhead, and less shiny

Collapse
matjones profile image
Mat Jones

This is wrong on all 3 points lol

Collapse
higginsrob profile image
Rob Higgins

I'm not getting in the middle of a python vs ruby debate, mostly because I don't care lol. There is nothing wrong with either language but devs will always swear their language is best because it worked well for their specific need.

Collapse
naseki profile image
Naseki Author

Wow, we got a Lambda lover here! 😀 Happy to hear that you found a stack that feels right to you! I've never quite looked into AWS before, but I probably should.

Collapse
higginsrob profile image
Rob Higgins

Ha. I've deployed aws ecs in production for years, it really depends on your apps needs. It's been my experience to make a good serverless app you have to write a lot of your own devops tooling. But once that's in place, the serverless nature alleviates all the hardest pain points surrounding scaling, versioning, and zero downtime deployment infrastructure.