Choosing Cloud Infrastructure: When Ridesharing Servers Makes Sense
Written by Adam Drewes 02/09/17
If you live in a major city, you have a lot of options for getting around, and you probably take some form of mass transit for your daily activities. But what about those times you need to go further than a few miles? Do you own and maintain a car? Rent a car for longer trips? Or just get an Uber? The answer likely depends on how well you think you can predict your travel needs.
Cloud infrastructure offers you similar options for creating and running applications: Infrastructure-as-a-Service, Backend-as-a-Service, and Functions-as-a-Service. Which makes the most sense for you will depend on how quickly you scale and how predictable your usage is going to be. Choosing the right cloud infrastructure can save your company significant money and your team a great deal of time, so you’ll want to make sure you get it right. Let’s take a look at each option.
Infrastructure-as-a-Service offers access to computing infrastructure in a virtualized environment. It’s what most people think of when they hear the term “cloud computing.” The service provider furnishes the hardware, storage, servers, and data center space or network components, while you purchase, install, configure, and manage your own operating systems, middleware, and applications.
With IaaS, you’re paying for VMs, and you can add more or scale back when you need to. This model eliminates the capital expense of deploying in-house hardware and software, while also solving data backup concerns reliably.
There are drawbacks to IaaS. Your internal team is responsible for systems management and monitoring, which requires specific expertise. While it is scalable, you still have to make sure you’re prepared for demand and increases in traffic. And it’s time-consuming to recreate stacks for each new app you’re developing. It’s just not very agile.
IaaS is the most affordable way to go—if you have a team experienced in server management and you can reliably predict your usage. Going back to the car analogy, IaaS is like buying a car. You’ll have a set payment amount regardless of how often you drive it, and you’re responsible for maintenance. If you have the time and experience to maintain your own car and you know you’re going to be using it a lot, it’s significantly cheaper in the long run than renting or ridesharing. IaaS is best for established companies with the necessary resources to manage VMs and trackable usage patterns.
With Backend-as-a-Service, some of the work is handled for you. The service provider offers an API and a software developer kit (SDK) to integrate with their backend. Services like storage, Analytics, Push notifications, dashboards, social integration are also provided, saving developers a lot of time and eliminating the need for system administrators.
While traditional mobile app development requires a developer to incorporate each back-end API individually, BaaS moves the app integration to the cloud. Developers can easily connect front and back end mobile app elements. Parse and Firebase are both popular BaaS services.
Backend-as-a-Service has a couple of big benefits. There’s no need to start from scratch, re-creating, changing, and reassembling stacks. The common underlying base makes it easier for multiple developers to work on projects and makes it simpler to link apps across platforms. The team can focus on the front-end, putting their energies into the user experience. And BaaS is more scalable—developers don’t need to concern themselves with increased demand or server storage for traffic.
One drawback is that that backends are vendor-specific, meaning that although developers can migrate apps to a new provider, they would need to recreate the connections to the new backend.
BaaS is recommended for startups or other companies with small teams or that don’t have staff knowledgeable about backend development. While you’re paying for everything you get with BaaS, it’s frequently cheaper than hiring a full-time team members to handle the work BaaS takes care of for you—especially if you aren’t sure how quickly you’ll grow and what your usage will be. It’s like renting a car. You pay more per week than you would with a car payment, but if you’re not going to use it consistently every week, it’s smarter to go the route of renting. BaaS is also a great choice for projects that need to be created quickly.
Functions-as-a-Service, which is relatively new on the serverless scene, takes it a step further than BaaS. With FaaS, you don’t have to manage your own server systems or your own server applications.
FaaS is also completely flexible. You’re not limited to a specific framework or library. Your developers simply code applications as they normally would, then upload the code to the FaaS provider, which handles everything else. Horizontal scaling is taken care of automatically, without the developers having to even think about it. AWS Lambda and Azure Functions are two of the most popular FaaS vendors.
FaaS isn’t without its weaknesses. While FaaS is flexible when it comes to programming languages, frameworks, etc., features are implemented differently by different vendors. So if you want to switch providers you may need to update your operational tools, change your code a bit, or even change your design or architecture. This is one reason it’s so important to choose a good vendor. You’ll also need to implement a few additional security measures, depending on how you use FaaS.
Another drawback is that FaaS functions have significant restrictions when it comes to local state. It’s unlikely that any in-process or host states that you create will be available to any subsequent invocation. FaaS functions are either naturally stateless or they make use of a database, a cross-application cache, or network file store to store state across requests or for further input to handle a request. FaaS functions are also limited in how long each invocation is allowed to run. AWS Lambda terminates after 5 minutes, for example. So some classes aren’t suited to FaaS functions—you’ll need to re-architecture them. These drawbacks are solvable, but you should be aware of them.
Despite these drawbacks, there are several advantages of going with FaaS. The biggest is reduced operational and development cost. You pay only for the compute time you consume, and there’s no charge when your code isn’t running. You don’t need to hire team members to manage servers, databases, or application logic. You can run your company on a skeleton crew, which is an invaluable ability for a lot of companies, especially startups. Another cost-saver is that when you make performance optimizations to your code, you’re not only making your app better but also reducing cost—because you’re paying for compute time only. And developers tend to love FaaS because of its speed. They can build applications even faster than when they’re only using BaaS. Time to market is reduced drastically. It’s like getting an Uber at the last minute when you need to get all the way across town. Convenient, and it makes a lot more sense than buying or renting if you’re not sure yet how often you’ll need to make that across-town trip.
FaaS is a perfect solution for most startups that aren’t sure how quickly they’ll grow. It’s also highly recommended for applications that experience wide and unpredictable swings in usage. If fortune shines particularly bright on your ads one specific day and you get a lot of activity, no problem. Your FaaS provider takes care of it. Slow day? You’re not paying for it.
How to Choose
Your decision on which cloud infrastructure to choose depends primarily on where you are on the speed-of-growth spectrum and how well you can predict your usage. You want the infrastructure that will best support your ability to scale while at the same time manage your costs effectively. While your cost-per-unit does increase as you gain greater flexibility, unless you know for sure how much computing power you need when and can keep your department staffed appropriately, it makes sense to pay for that flexibility.