12 ms·
Serverless Architectures
- jtwaleson 10y agoIf your PaaS supports scaling down to zero (Heroku free tier, Cloud Foundry somewhere in the future) and resuming on incoming traffic, it's basically a much better version of FaaS. The way you deploy code, the way services are coupled to the app etc is much better.
- Skinney 10y agoHeroku is much slower at resuming on incoming traffic, because it has to boot up a dyno to serve your code. A cold start on Heroku usually takes 30 seconds (for me anyways). A cold start on AWS Lambda takes 2-5 seconds, which the user won't notice on my services because the frontend is served from S3 and rendering is client side. And the way services are coupled to the app is about the same. I've used both Heroku and AWS a bit, there really isn't that big a difference here, except that Heroku as a lot more third party services that can be connected.
- jtwaleson 10y agoSure, it's designed to be faster to boot up, but Heroku could optimize their startup time.
- Skinney 10y agoDifficult to do. Cold start time is slow on the free plan because they have to start a "server". They don't need to do this with the paid plan, but then again, you're paying for uptime of a server. Serverless don't need to do this.
- gmazza 10y agoServerless = new name for PaaS. VPS (virtual private servers) were available (and largely ignored) for quite a while before 2006, when AWS came along with the catchy word "cloud". This single word changed everything. Same technology all of the sudden became cool, and everybody started using it. Maybe now it is the turn of PaaS [1] - call it "serverless" and folks finally start seeing all the benefits (true scalability, efficient resource utilization, timely and painless software upgrades, et c.)? [1] https://en.wikipedia.org/wiki/Platform_as_a_service https://en.wikipedia.org/wiki/Platform_as_a_service
- andreasklinger 10y agoMight get this wrong but from my understanding: PaaS: Platform (as in Server eg used for API) on demand (as in api.something.com/*) FaaS: Function (as in eg api endpoint) on demand (as in api.something.com/v1/get_latest_posts) Of course you can create the 2nd with the approaches of the 1st but the from my understanding the main benefit is that you dont have to - as in: you can just take one endpoint and have it managed by something else.
- icebraining 10y agoYes, you could simply upload some code to the service, and they will be called only when there's a request to that particular code, instead of running a process continuously. It's called "shared hosting" and was invented in the 90s.
- jaegerpicker 10y agoIt's fundamentally different than that. This is a discreet function as a single function call that is deployed with no other code that you have written. This allows deployments of individual functions without affecting the rest of the services. While possible before almost noone actually did that.
- icebraining 10y agoI disagree, it was a common pattern to have a single .php file for each page, independent from each other, which would receive input params (GET, POST and COOKIE), sometimes connect to the database, and do all the processing inline, outputting the result. The whole file was essentially an implicit function. The appearance of frameworks with a single entrypoint and which load models and controllers and such is fairly recent in the PHP world. When I started writing websites, already in the 2000s, this was how I first learned.
- osipov 10y agoSince serverless is a kind of a PaaS, it offers many of the same benefits. However, unlike Heroku, Cloud Foundry, OpenShift, and other traditional PaaSes focused on supporting long running applications and services, serverless frameworks offer a new kind of a platform for running short lived processes and functions, also called microflows. The distinction between the long running processes and microflows is subtle but important. When started, long running processes wait for an input, execute some code when an input is received, and then continue waiting. In contrast, microflows are started once an input is received, and are terminated by the platform after the code in the microflow finishes executing. One way to describe microflows is to say that they are reactive, in the sense that they react to the incoming data.
- TorKlingberg 10y agoIs Google App Engine an example of serverless? The user does not really think about servers, and the code is mostly written as event handlers. The abstraction is a bit leaky though, and you can tell that there are instances being spun up and down.
- LionessLover 10y agoTerms such as "serverless" don't have a fixed sharp-edged meaning but are very fuzzy categories, except on a per-person basis, where you may (will) find people insisting on a specific meaning. When this story was submitted on some reddit forum (forgot which one) everybody was up in arms after just reading the headline, screaming "everything is a server" and "there is no cloud"! Don't take it too seriously. Human language is very deliberately a very flexible tool, with the same word fitting into very different contexts, taking on very different roles. Even in science, by the way.
- Skinney 10y agoDepends on what you mean by serverless I guess. GAE (and Heroku for that matter) still has the notion of code running on an instance, dyno, server whatever. When I think of serverless, I think of Azure Functions, AWS Lambda and the like, where the cloud runs a single function in response to a request. How is it run? Doesn't matter, you pay for what you use.
- spriggan3 10y agoUploading PHP scripts on a remote server provided by an hosting company is "serverless". I don't have to manage the server /s That buzzword means absolutely nothing.
- timshim 10y agoGoogle promotes Services on Google App Engine to be used in a microservice fashion. If you create a new project and click on Services, they include a link to the docs about microservices. So if we go by that, it seems to be more microservices than serverless. Based off the article, the serverless (FaaS) bit would be Google Cloud Functions.
- ewindisch 10y ago
- amelius 10y agoThe article totally skips (serverless) federated architectures, which are more interesting, in my opinion.
- LionessLover 10y agoAt the bottom of the article: > This is an evolving publication, and I shall be extending it over the coming days and weeks to cover more topics on serverless architecture including some things commonly confused with serverless, and the benefits and drawbacks of this approach. You can send a tweet to the author: https://twitter.com/mikebroberts https://twitter.com/mikebroberts
- LionessLover 10y agoAt the bottom of the article: > This is an evolving publication, and I shall be extending it over the coming days and weeks to cover more topics on serverless architecture including some things commonly confused with serverless, and the benefits and drawbacks of this approach. You can send a tweet to the author: https://twitter.com/mikebroberts https://twitter.com/mikebroberts
- stephenr 10y agoWhy not MTTaaS - Misleading Technology Terms as a Service.
- deleted 10y ago[deleted]
- paulddraper 10y agoSee, I though it was Multi-Troop Transport as a Service (http://starwars.wikia.com/wiki/Multi-Troop_Transport/Legends http://starwars.wikia.com/wiki/Multi-Troop_Transport/Legends). So +1
- Spearchucker 10y agoThe API gateway made me smile. In the 90's we had message queues. In the 00's we had service busses. Today we have API gateways. All they do is route requests - they're all the same thing. There's merit in serverless, no doubt. There are many things that worry me. Not owning the infrastructure means I don't get the telemetry I'd like, making triage difficult. Direct access to the database is a good idea said nobody ever. And at what point does my own infrastructure become more cost-effective than cloud? Those concerns don't invalidate the applicability or relevance of serverless though. I think its value as a protyping tool, or to validate a proof of concept is huge.
- rahkiin 10y ago> And at what point does my own infrastructure become more cost-effective than cloud? I am no expert at all, but one idea came to mind: say you have this small festival each year (or once) where you have 1 month (or less) you can buy tickets. Instead of setting up, securing, etc a whole server stack you can simply run te ticket-purchase code on a FaaS and have a database with results. Running your single page app all year on a very simple host, but having this database and compute thing only one month.
- dottedmag 10y agoOr, better, utilise PaaS service for ticketing, which hopefully has better UX, design, security etc.
- marktangotango 10y agoThe vast majority of web sites on the internet today don't need much infrastructure, they're low traffic blogs, web sites for the hair salon down the street, or a landing page for a non software corporation. Facebook fills this role for a lot users, and they in turn sacrifice their data and privacy to a souless corporation. Don't forget the $billions dollars industry of shared hosting providers out there. A lot of businesses still pay $10 a month for a shared server, mysql, and php. Why should this be the case? Why should it cost anything to have an online presence today? Why shouldn't users own their data? In my personal opinion, these types of FAAS (function as a service) and mBAAS (mobile Backend as a service) the article is talking are an enabling technology in this regard.
- kabes 10y agoHow did this came to be known as serverless? It just seems to be an extreme case of microservices running on someone else's computer?
- dingaling 10y ago> How did this came to be known as serverless? Indeed, 'blameless' would seem more appropriate. All the best trying to recover a 'serverless' application when one portion fails; lots of late-night phone-calls and picking-through the terms of SLA documents in that future compunded by the fact that most serverless advocates say that you can dispense with operations staff...
- easytiger 10y agoThe other buzzwords have run out.
- Skinney 10y agoI think it might have something to do with the fact that the payment model isn't connected to a server instance, but how often your code is run. Heroku, GAE etc. are server-oriented. Your code is running on a dyno or an instance, and you pay based on the number of instance-hours you use. In AWS Lambda, or Azure Functions, you pay for the number of requests you process and the time spent processing those requests, how many instances are spent processing those requests are irrelevant. It's a serverless payment modell.
- infodroid 10y agoIt is misleading that the HN title suggests the author is Martin Fowler, but this is not the case for this guest article. The actual author is Mike Roberts, the article is hosted on Fowler's site.
- Tomte 10y agoYes, but that's probably because the HN submission bookmarklet puts the site name behind the dash. It annoys me every time I'm submitting something. But evidently not enough to finally edit the bookmarklet.
- jrs235 10y agoDitto about the annoyance. Never thought about editing the bookmarklet... I'm going to do that now!
- mikebroberts 10y agoIf you are able to do that you would have my appreciation as the article author! :)
- jrs235 10y agoHere's is my slight change to the bookmarklet code. It's not fool proof and and I'll have to see if it actually results in me editing submitted story headlines less often or not. It basically takes the substring of the document title from the start until it finds the first hypen (-) or pipe (|) which are what seems like most sites use when appending the site name. javascript:window.location="http://news.ycombinator.com/submitlink?u="+encodeURIComponent(document.location)+"&t="+encodeURIComponent(document.title.substring(0,document.title.search(/[-|]/)).trim())
- gaius 10y agoOh, I'll read it then - thanks! :-)
- loup-vaillant 10y agoWhat kind of evil genius devised a term that suggests peer-to-peer, to describe something that relies more than ever before on central services and authorities? It feels like "intellectual property" all over again —which suggests the rules used for rival goods can be used for ideas, hence ignoring the difference between moving and copying.
- ewindisch 10y agoBecause the main premise of "serverless" is function-as-a-unit-of-deployment, it's actually quite suited for distributed computing and works quite well in decentralized architectures. Using serverless, it's easier than ever to build "hybrid" clouds constructed of resources both locally and on public clouds (Google, Amazon, Azure, BlueMix, and others). We can even deploy that code to IoT devices and embed it inside of desktop and mobile apps. Serverless frees us from lock-in, but it does not have its own state, so it's easy to become locked into various web services. However, it's also easy enough to rely on your services (microservices) for state, avoiding lockin to other IaaS/SaaS products.
- Joeri 10y agoUnless and until there is a standard for function-as-a-service so you can move your functions between services at a moment's notice, you're very much locked in; and locked in without any guarantees of quality of service.
- ewindisch 10y agoI am involved daily in precisely an effort to do just this. The differences between the big 3-4 providers is relatively marginal (call arguments and versions of interpreters such as NodeJS). Take it as a plug if you must, but being able to handle the former is one of the goals of https://github.com/iopipe/iopipe https://github.com/iopipe/iopipe. The version of language runtimes is where the most lock-in will occur, and really, that's kinda marginal, too. Language runtimes should be as stable and standard as, say, the Linux kernel's userland interface. If language runtimes can't deal with this, then they'll fail.
- Touche 10y agoWith this type of architecture, aren't you creating latency by separating out the "backend" from the database? In the traditional approach the backend server and database are in the same datacenter, but it seems that's often not the case in FaaS approach, what are the ramifications of that?
- SideburnsOfDoom 10y agoIf you were on AWS, I would expect the Lamdba fn to be running in the same datacenter as the backing dynamodb table, or at least in the same region. dynamodb response times are pretty good - typically under 10 milliseconds.
- Touche 10y agoThanks, is this something you have to be aware of when setting this all up or does Amazon do this for you?
- SideburnsOfDoom 10y agoAWS is far from simple, and there is a lot to learn. For a start, you will need to know what a Region and Availability zone are: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-reg... Roughly speaking: A region is a geographic location (e.g. eu-west-1 is in Ireland and eu-central-1 is in Frankfurt, Germany) The "Availability Zones" are separate datacenter buildings in that region connected by fat pipes. For fault-tolerance, it is common to make sure that all of app's parts run across multiple availability zones in the region. This will happen without much manual config. Crossing regions is very different - it's not going to happen automatically, they're pretty much isolated from each other. Only a few extremely-highly-available apps (e.g. netflix) have engineered to cross regions. See https://www.infoq.com/presentations/netflix-failure-multiple-regions https://www.infoq.com/presentations/netflix-failure-multiple...
- jlward4th 10y agoIn regards to Stateless and 12 Factor... > This has a huge impact on application architecture, albeit not a unique one - the ‘Twelve-Factor App’ concept has precisely the same restriction. While 12 Factor does say that processes should be stateless I've never thought it really meant it. Connection Pools and in-memory caches are pretty typical in 12 Factor (or all non-serverless) apps. And for me that is what makes serverless kinda silly. Some global state is actually pretty useful when you can avoid the overhead of initializing things or going over the network.
- osipov 10y agoServerless apps should be stateless but should work in conjunction with stateful apps. Unlike Heroku, Cloud Foundry, OpenShift, and other traditional PaaSes focused on supporting long running applications and services, serverless frameworks offer a new kind of a platform for running short lived processes and functions, also called microflows. The distinction between the long running processes and microflows is subtle but important. When started, long running processes wait for an input, execute some code when an input is received, and then continue waiting. In contrast, microflows are started once an input is received, and are terminated by the platform after the code in the microflow finishes executing. One way to describe microflows is to say that they are reactive, in the sense that they react to the incoming data.
- icebraining 10y agoBut how is this different from coding in, say, Django? In Django you write a "view", which is just a Python function that is started when an HTTP request is received, and terminates by returning an HTTP response object. Then there are models, but these are just a translation layer between the Database and the view function, they don't keep state either. I don't see how a Django view isn't a "microflow". It seems to me that the architecture is exactly the same, it's just that you don't get to choose the web framework.
- mikebroberts 10y agoThere's definitely a performance tradeoff, one which I reference a little in the latest part and will definitely talk about more when I get to drawbacks (likely in the 5th update.) There's definitely a big class of applications where FaaS with its current limitations isn't a good choice, but I wouldn't say that class is universal. 12 factor statelessness I read as meaning more application / domain state rather than infrastructure state btw.
- i_have_to_speak 10y agoAh, the PetStore example brings back memories! Wonder how many people remember it?
- mikebroberts 10y agoWelcome to Old Developers Club. :)
- asimuvPR 10y agoNot old, but seasoned with salt (white hair). :D
- mikegerwitz 10y agoThere are a number of things I find alarming about this (which is nothing new): Firstly, the author is encouraging the conversion of traditional web pages to single-page web applications, which means that users would now have to download actual software to use the website rather than using the software that they already have and trust: their web browser. Perhaps most alarming is the acknowledgement of this: > One of the main benefits of Serverless FaaS applications is transparent production runtime provisioning, and so open source is not currently as relevant in this world as it is for, say, Docker and containers. This highlights the major issue of SaaSS/SaaS, and FaaS takes it to the extreme: https://www.gnu.org/philosophy/who-does-that-server-really-serve.html https://www.gnu.org/philosophy/who-does-that-server-really-s... Not only does the user not have control (as in the case of SaaS), but in the case of FaaS, the actual author is relinquishing the same control. These suggestions all "make sense" from an architectural perspective (depending on who you ask, and depending on the software being written). But I plead for others to consider whether this is necessary in their particular instance; it's the default thinking now-a-days: want to write a program? Want a wide audience? Want it to scale? Put it on the Web, make it a service, store it and all user data on someone else's computer, and call it "the cloud". I expressed my opinions and concerns at LibrePlanet 2016: https://media.libreplanet.org/u/libreplanet/collection/restore-online-freedom/ https://media.libreplanet.org/u/libreplanet/collection/resto...
- mikebroberts 10y agoHi Mike, Article author here. Don't worry, I'll be laying on some cold, hard, reality later in the series. I definitely don't encourage SPAs universally and I'll be talking extensively about the concerns of handing over responsibility to vendors.
- mikegerwitz 10y agoThanks for the reply, Mike; I'm looking forward to reading your opinions, and I'm glad you'll be discussing it. From a technical perspective, your article was very informative, and I did learn from it, so thank you for the information.
- 10y ago
- qaq 10y agoshared hosting reinvented :) Name is way cooler though
- known 10y agoTorrent ?
- agentgt 10y agoWe sort of do this for a JVM with the exception that it is the JVM and you really can't be rebooting it all the time. What we do is use a message queue and extreme thread isolation. Are internal framework is sort of analogous to an actor framework and/or Hystrix but is stateless through out. Messages are basically functions that need to be run. That being said because our whole architecture is message driven and uses a queue with many client implementations we have been experimenting with OCaml Mirage and even some Rust + lightweight container because of the serious limitation of booting up the JVM.
- winteriscoming 10y agoAs someone previously noted about serverless architecture - https://twitter.com/jf/status/739971456302350336 https://twitter.com/jf/status/739971456302350336
- Mister_Snuggles 10y agoThe serverless architecture appears to have many servers provided by different people instead of having no servers, as "serverless" leads me to think. Is this just trading wrangling a server farm for wrangling contracts with 3rd party service providers? Am I missing something?
- zippy786 10y agoServerless is just a buzzword similar to NoSQL to gain traction, nothing new!
- stickfigure 10y agoBy this definition, we've been running "serverless" on Google App Engine for most of a decade. * We don't monitor how many instances are running and don't really care. Our "functions" are http endpoints. GAE spins up or down instances to meet the load. Our interface with "instances" is just the size of the bill at the end of the month. * Async task processing is also just an http endpoint function. We even have a little bit of syntactic sugar so it looks like we're just adding functions to a queue. * We have no ops or devops staff. We just deploy code that implements functions (http endpoints). * Persistence is also scaled by Google; there's no database server, just an API to read/write data that scales infinitely (or at least, scales with linearly our bill, not limited by the dataset). It sounds to me like the article is trying to distinguish between "serverless" and PaaS by describing PaaS done poorly. For the longest time, GAE didn't even expose the # of instances servicing your app. They've exposed a lot more of the underlying constructs since, but you can still ignore them unless you're trying to hyperoptimize your bill.
- osipov 10y agoIf GAE has had "serverless" for most of a decade, then why did Google decide to create Google Cloud Functions? https://cloud.google.com/functions/docs/ https://cloud.google.com/functions/docs/
- daxorid 10y agoFunctions looks interesting, but only supports node.js. GAE has the advantage that it support multiple language targets.
- deleted 10y ago[deleted]
- vgt 10y agoI think OP's chief argument is that "serverless" is monopolized by AWS Lambda and the like, and probably unfairly. The answer is that Cloud Functions and AppEngine fulfill different use cases. There's clearly room for both.
- zippy786 10y agohttp://martinfowler.com/articles/serverless/sps.svg http://martinfowler.com/articles/serverless/sps.svg Is there something wrong that the client browser is connecting directly to the database, so JS -> MySQL direct connection won't expose credentials ?
- losteric 10y agoIt doesn't say "MySQL database". The client could conceivably connect to something like an ElasticSearch database (JSON API), setup with no auth/read-only permissions and appropriate rate-limiting.
- zippy786 10y agoYou are really talking about a very small use case if you say the only database that could be used would be no auth/read-only considering most database requires auth for security and most apps need to write.
- detaro 10y agoAnd then you use a "function" behind the gateway for the parts that need to write or need to see things that need authentication. Just like in the diagram...? Nothing says that you can only allow public access to a database.
- joefkelley 10y agoThe one thing I haven't seen discussed in the serverless world is state as optimization. For instance, if I have a machine learning application that has to access a very large trained model, I would like to load that model into memory at application startup. Loading from disk at every "function call" would be too slow. So would making RPC calls to some external "model cache" service. Does AWS Lambda / similar have some sort of overridable "init"?
- jedberg 10y agoThat would be a case where you wouldn't want to use a purely serverless model. You'd want a persistent server that loads the data and then exposes it as an API for your other serverless functions. That being said, it's important to remember that Lambda doesn't reload your function for every function call. It loads it on the first call and then keeps it active for a few minutes as long as there are still requests coming in, so you'd only have to deal with that initial load once in a while (or almost never if your function is active enough). Unless you had a way of extracting your model into a very fast database.
- findjashua 10y agos/serverless/zero-ops/g
- api 10y agoTrouble is most of these are completely single vendor and closed. If you build your app for Lambda, theoretically you've built it to run on one computer: the AWS lambda "main frame."
- jaegerpicker 10y agoThat's not really true. Lambda apps are just a collection of node.js modules that are defined at the function level. I can and have easily port a Lambda app to a node.js express app, infact I did so for a Lambda app that was non-trivial (400 functions defined) in about half a day.
- la6470 10y agoCan you start a webserver in a serverless environment? No not yet !!! if you need a webserver go for a container... oops now we are entering the realm of servers... oh no i dont want to manage a webserver cries the developer. So bring up the most humongous webserver you can find on earth and tell them you just put your app here and rest is MAGIC!!
- k__ 10y agoHow does this work with WebSockets? Like, a bit more than FaaS, but less than PaaS?
- jkarneges 10y agoRaw WebSocket handling could be delegated to something like Pushpin [1] (disclaimer: author). This way, the backend doesn't have to maintain any long-lived connections of its own, but it retains a similar level of control over each connection that a full backend would have had. As an experiment, we built a chat app like this (using Stamplay as the FaaS) and it actually worked. [1] https://github.com/fanout/pushpin https://github.com/fanout/pushpin
- krislig 10y ago"1. Often require vendor-specific language, or at least vendor-specific frameworks / extensions to a language" ... "(1) is definitely not a concern for the FaaS implementations I’ve seen so far, so we can scrub that one off the list right away." That point do not make any sense to me. You have to follow the AWS Lambda programming model which is specific to AWS Lambda, so either way you are tied to some libraries and patterns which are vendor-specific.
- ecthiender 10y agoI think the word serverless makes more sense in p2p/decentralized architectures, than in platforms using pre-built servers.
- deleted 10y ago[deleted]
- Animats 10y agoIt's just outsourcing. It "depends on 3rd party applications / services (‘in the cloud’)" It's like Salesforce's "No Software". A real serverless architecture would be federated, like BitTorrent or Bitcoin.
- Aaronik 10y ago#content { margin: auto; } y/w :D :D
- dreamdu5t 10y agoServerless now means "servers in the cloud" ? So what do we call apps that don't use servers!? I'm actually writing one right now...
- MichaelMoser123 10y agoSo the web page now has to contact a lot of servers. That means more round trips and worse security - more endpoints means a bigger surface for attacks. Also you know what data is on what server - you just have to inspect the javascript source code. Is this a good idea?
- guylepage3 10y agoI feel blockstack.org offers the best serverless technology.
- eazel7 10y agoWrong. All wrong. Serverless is like what is the server standing on before the server? That is serverless. Peer to peer mesh discovery protocols, for example. Serverless implies no server. Buzzz buzzzzz buzzzz buzzzz. Sexless sex.