Back to Insights

News

Pay-As-You-Code: The Economics and Advantages of Serverless Computing

Engineering Workshops are interactive, collaborative articles that address a variety of web development topics, from big questions about how the Internet works, to more specific issues like web page processing.

Our in-house subject matter experts work hard to bring these technical, nuanced subjects to life in an engaging way, because we want to share our knowledge with anyone who’s interested in learning more about us or the services we provide. These workshops are a part of our ongoing commitment to demystifying the outsourcing process - we share what we know so that everyone we work with feels comfortable and confident at every turn.

Infinite possibilities backed by finite resources: the economics of the internet

We often think of the internet as an infinite resource; a tool that’s always available and impossible to truly exhaust because it’s built by digital blocks, not physical bricks. The reality is that the websites and apps that we use every day are created and maintained using finite resources, and it’s entirely possible to over-invest in these resources, and waste them, just as it’s equally possible to under-purchase them and end up requiring more than you actually have. As Front End Developer, Craig Sloane explains in detail, below, there is a computing method specifically designed to avoid this wastefulness: serverless computing. In order to understand this solution, it’s helpful to start with an overview of the problem it’s been created to solve. When it comes to developing a web app, part of the finite pool of resources used to build and maintain it are back-end services, which is the part of web and app development that users don’t typically see. Back-end services respond to commands and requests by a user and provide data and information that the front end of a website displays in a way that makes sense. For example, when a user types a web address into a browser, the browser sends a request to the backend server, which then responds with the website data. The user then sees the front end of the website, which usually includes text, images, graphics, animation, and any other components that may make the site more attractive to the user, or easier to use.

If the site visited is a clothing store, the user may choose to search for blue shirts in a size 10. When the user makes that request, the backend code checks its database (a server) to see if there are any items that match those parameters. If there are, the back-end will pass that information to the front-end, which will once again display that information to the user in a manner that makes sense. This near constant back-and-forth underpins our ability to use the internet, but the reality is that servers don’t have unlimited space, and developers and companies don’t always have access to as much space as they need. Said otherwise: it is entirely possible to produce a situation where this critical process is interrupted simply due to the fact that finite back-end resources aren’t traditionally distributed in accordance with actual internet use.

The bandwidth rental scheme

Servers - including modern cloud-based servers - are computers. They don’t have screens and keyboards like the computers most of us use in our day-to-day lives, but they occupy physical space just like any other computing device. Most developers building web apps don’t own or store their own servers: due to their cost and size, they’re almost always owned and operated by vendors who sell fixed units of server space (bandwidth) to developers and companies who build these products. Server space, as it happens, is a pretty hot commodity. This bandwidth rental scheme is where the concept of waste - and the alternative of serverless computing - becomes important. To ensure that increases or spikes in traffic won’t compromise their apps, developers and companies often over-purchase server space. Because the cost for this bandwidth is fixed, this means that a lot of server space that gets paid for actually goes to waste. Conceptually, this is similar to paying for unlimited data on a mobile phone and only making a few calls. Serverless computing, on the other hand, allows companies and developers to purchase back-end services on an as-needed basis. This means that only the bandwidth that’s actually used ends up being purchased, and nothing goes to waste. Thus, ‘serverless’ computing does not mean computing without servers, but rather computing without having to worry about servers, and the benefits are clear. Craig explains here. When a developer builds a serverless application, they have the option to represent their IT infrastructure (ie, the server) as code. Said otherwise: developers can automate their infrastructure instead of manually interacting with their server’s interface to roll out development changes. As Sloane explains here, the benefits to doing this include improved speed and safety when deploying code, enhanced efficiency, and greater quality control, to name just a few. To see exactly what it looks like to represent infrastructure as code using Serverless Framework and AWS (Amazon Web Services, a cloud computing platform), watch Sloane walk through this basic demonstration.

Supply and demand: a computing model to balance the digital economy

Ultimately, a serverless computing framework is one with the potential to work faster, safer, and more efficiently. Crucially, serverless computing allows developers to build products without worrying about whether they have access to the backend resources they need to continue working. This model allows for companies and engineers to pay-as-they-code, which reduces waste and saves money. The internet may feel like an infinite resource, but the reality is that the web and all of its functionality is supported by services that are in high demand, and often in short supply. Serverless computing isn’t perfect - it’s a relatively modern model of execution that’s always being improved - but it does help to balance a digital economy of finite resources, and that’s an improvement, all on its own. Interested in joining our engineering team? Visit xDesign careers.