4 ms·
Despite the absolutely terrible inefficiencies, the scaling benefit these """serverless""" technologies provide is hard to replicate with traditional software.
by jeroenhd 5y ago
Despite the absolutely terrible inefficiencies, the scaling benefit these """serverless""" technologies provide is hard to replicate with traditional software. Throwing a Javascript file into some *aaS platform and having that run on a datacenter near the user, automatically upload the output to storage near the user, and scale up dynamically if there's a sudden influx of thousands of users is very hard to accomplish manually without reserving tons of VMs or using some kind of data center API with auto provisioning.
Most businesses have no need for such a system, of course, and the costs per function execution are astronomical in comparison to a native program, but for some use cases, the benefits outweigh the costs.
As for Ruby and Python, the cost is measured in dev time rather than server costs. Servers are cheap compared to devs, and if a dev can pump out a feature three times as fast because they can make use of a simpler framework, you can afford the overhead of slower programming languages.
For this reason I'm watching the Rust space with interest, because the speed is much closer to C++ than to the traditional Java/C# servers most big applications are written in, but the frameworks are slowly shaping up to be similarly complete. Of course, there's a huge difference between Rust and most other languages that cannot be overlooked, but services like Vaultwarden show an interesting opportunity in the server space. It'll still be a while before the tools and frameworks reach a similar level of usability, though.
- reilly3000 5y ago> having that run on a datacenter near the user This is the biggest deal IMHO. FaaS in CDN edge DCs are remarkably fast and affordable. If you can respond to an API call faster than a request can get through to a load balancer, you're providing quite a UX improvement regardless of cost. For most people running stateful apps this requires some large tradeoffs in the form of the data layer, but they are getting more reasonable over time. In the case of CloudFlare which may have the strongest edge function hosting now, it used to only support its Worker KV data store (fast but KV only and globally eventually consistent ~10 secs). More recently they have added support for fast connections to their R2 (S3-like) service, and now they have a new service that can proxy to MySQL and Postgres databases. https://blog.cloudflare.com/relational-database-connectors/ https://blog.cloudflare.com/relational-database-connectors/ Its an exciting space, because its not just about CDNs: as 5G towers are rolling out, they are building in edge compute clusters along with them. So now you have a 5G iPhone with faster single-threaded performance than your desktop able to get 1Gbps down and faster response times because of its path to edge compute. ISPs are also getting in the game: https://www.coxedge.com/serverless https://www.coxedge.com/serverless https://www.limelight.com/resources/data-sheet/edge-compute/ https://www.limelight.com/resources/data-sheet/edge-compute/
- invalidname 5y agoI think that's sort of against the pareto principle. Assuming you have the physical data near the user. Great. But most of these functions then go on to fetch stuff from elsewhere with its own delays and problems. Even if S3 or cloudflares equivalent is replicated everywhere there would still be a networking delay and context switch waiting for a response. If performance is THAT important you would be better served with a HUGE machine with a huge cache of the database. That's not something you can do with a FAAS. Other than saying "hello world" fast. I can't think of a proper use case where the performance of FAAS would be realistically better than a dumb monolith. The performance and complexity overheads of FAAS make the case even harder to make.
- reilly3000 5y agoCF’s Durable Objects product which I neglected to mention above attempts to be that huge database and cache. The CAP theorem isn’t violated, it just embraces consistency while relying on the partition tolerance of their POPs and backbone. Their KV store is more about availability. https://blog.cloudflare.com/durable-objects-ga/ https://blog.cloudflare.com/durable-objects-ga/ I don’t disagree that a huge database can handle an astonishing amount of load but at often unreasonable expense. There as many cases where FaaS is dramatically more affordable to run, both in compute cost and ops time. There are others where its costs spiral out of control under load and with dev effort to fit its constrained programming models. Its hard to say its entirely a trendy frivolity when there are many use cases where its the best tool for the job.
- Zababa 5y ago> This is the biggest deal IMHO. FaaS in CDN edge DCs are remarkably fast and affordable. If you can respond to an API call faster than a request can get through to a load balancer, you're providing quite a UX improvement regardless of cost. How much faster will this be? I think even for servers on the other side of the planet, the max ping will be something like 500ms. I think most pings in the same continent will be something like 100-200ms. On the other hand, a Node hello world was 164ms. That means that compared to just being in the same continent, you don't have much of an advantage. Python is ~30ms for a hello world, That's better. On the other hand, the "competition" is marked as 250ms for a cold start. That's a lot, and I doubt you get the benefits of being close to the user at this point. There may be some things I missed, I don't know much about that space.
- BiteCode_dev 5y ago> if there's a sudden influx of thousands of users A $10 VPS will manage thousands of users fine for most CRUD apps. You don't need tons of VM. You can always make it a... $20 VPS to have some margin if you fear HN hug of death. You won't get a CDN close to the user or automatic backup, but that's really fine for the immense majority of projects. It takes one hour to setup a VPS with nginx, python/node/ruby and postgres. Then it mostly runs on its own for years: no coldstart problem, no kubs to manage. I get the benefit of the cloud at scale, but for thousands of users, it seems really overkill.
- jeroenhd 5y agoIt depends on what the code is actually doing, but you're not wrong in most cases, especially the HN hug of death. I host all of my stuff on cheap VPS servers for example. Some tasks, though, are just terribly slow. For example, crawling a webpage and taking a screenshot of it sounds incredibly easy but turns out to involve a lot of resource-intensive moving parts. The most common solution I see involves running Chrome in a container and taking a screenshot. That kind of code can easily overwhelm even a moderately expensive VPS with just a few clients. On the other hand, most CRUD stuff and frontend-heavy applications would run fine even off a modern Raspberry Pi. You can't just let something run, though, because you need to manage system updates. It's something you can easily forget if you have tons of other stuff to do, so the laziness factor also helps defend the *aaS setup. I don't like serverless, I think it's the next step in more wasteful programming by people who can't or don't want to understand the systems underlying their code. We're at the point where shipping an entire operating system along with an application has somehow become the norm, and I don't like the fact that eventually I too will need to learn this serverless crap.
- BiteCode_dev 5y ago> It depends on what the code is actually doing Indeed, things like video encoding, machine learning, graph traversal, etc, can be pretty expensive. But then again, our tooling are so powerful these days you can get away with a lot. Timeseries ? Clickhouse is your friends. Need geo calculations ? PostGis is here. Need to extract frames from a video ? ffmpeg will do that in a few cpu cycles. Data analysis ? Say hello to pandas. Validation, caching, expiration, encryption, workflow, pub/sub, logging, reporting... We have amazing solutions for everything that will let you scale up to the millions of users for few hundred dollars. In your example with the screenshots, one can imagine putting them in a queue (5 minutes setup with python-rq + redis) or even more low tech, a cron, and suddenly your VPS can take one screenshot every 2 seconds, which is 43200 in a day. That's a lot of screenshots. Your client need the screenshot immediately ? The browser can take a screenshot from JS with html2canvas. Sometimes it feels we are using $TECH because there is a whole class of devs that can't find solutions to problems: - don't want to think about your data structure ? Put everything in no sql. - don't want to think about your deployment ? Put everything in a container. - don't want to think about your algo ? Put everything in the cloud. Of course, in the end, you still have to think about all that no matter the tool you use. You just moved the cost somewhere else, usually paying much, much more later. In fact, even most of the stuff I get paid to do using Django could be done cheaper with wordpress. I'm already overkilling it.
- IshKebab 5y ago> Servers are cheap compared to devs Yeah to a point, but Python is so much slower than fast languages that your devs will spend longer trying to optimise it and write parts in C++ that you may as well have just written it in Rust or Go or Java or C# or whatever in the first place. And I don't buy "development in Python is faster" even ignoring performance. Maybe for tiny programs but once you get to reasonably sized ones the lack of good static typing makes all changes extremely tedious and error-prone. Plus you have to spend a mountain of time writing tests that you wouldn't even have had to think about with stronger typed languages. I can definitely fix bugs in Typescript or even C++ way quicker than I can in Python.
- OJFord 5y ago> And I don't buy "development in Python is faster" even ignoring performance. Maybe for tiny programs but once you get to reasonably sized ones the lack of good static typing makes all changes extremely tedious and error-prone. Plus you have to spend a mountain of time writing tests that you wouldn't even have had to think about with stronger typed languages. This really rings true with me, on both sides - I mostly (have) only use(d) python professionally; on semi-mature projects with some buried bodies etc. I spend my days wishing it was Rust (or that the JS was TS) thinking that that would be easier, or that the bug I'm fixing never would have existed. But then when I spend my own time starting something for fun, and so naturally use Rust to avoid that, it annoys me that it takes so much longer to get going and if only I'd decided to use Python, etc.