Emerging Technology

Serverless Computing Simplifies Chatbot Maintenance

Serverless computing is a great solution for hosting your chatbot. See the history of serverless and why your bot should be hosted there.

July 10, 2018

Serverless web hosting is the internet’s latest paradigm shift. It’s an excellent solution for hosting many applications. And, for hosting chatbots, or bots, it’s nothing short of revolutionary.

As revolutions go, this one will be pretty quiet. The front end isn’t going to look any different for your users. But this new infrastructure will mean a world of difference for developers and businesses.

Hosting technology has gone from data centers to cloud computing and now to serverless, function-based computing. Here’s a look at the history of web hosting and what this bright future means for bot development, in particular.

The first incarnation: Hosting with your own server

First, let’s talk about how it was in the olden days of the internet.

Imagine you were an enterprising young web developer in 2006. (Yep, those were the olden days.) You’ve been working on a website, and you’re ready to launch. You go to Best Buy and pick up a server-class machine, or maybe you dig an old computer out of your garage. You have the classic debate as to whether you’ll run your server with Linux or Windows, and then you install the software. Now you have a server that can deliver your website to users around the world. Congrats, you’re online!

Unfortunately, in this scenario, the battle has only just begun. Running your own server and the affiliated hardware—in 2006 or today—is a feat of maintenance, security, and load estimation.

Server maintenance

The core of your server is its hard drive. The hard drive spins around thousands of times in a second, and you’re probably running it 24/7. It’s not going to last forever. So, in case of hard drive failure, you need to back up your data somewhere else continuously.

All that spinning generates heat and noise. You’ll need to keep your server cool, possibly with fans or a sophisticated liquid nitrogen system. And servers are loud, so you’ll need to put it somewhere that the noise doesn’t get to you, like your basement, garage, or spare room.
Your hard drive can also malfunction. The RAM can go bad, an OS update can break functionality, the motherboard can fail, or the processor can overheat. If you don’t have a failover system in place, the site controlled by this machine goes offline until the issue is repaired. If you don’t have spare parts on hand, you might have to wait several days for a replacement component to be shipped before you’re back online.

Server security

Running your own server also requires constant vigilance, in terms of security. Unless you’re a cybersecurity expert, there are probably many, many people out there who could hack your machine with ease. Your data is vulnerable to being accessed by an outsider. You could also suffer a DDoS attack that overloads your server with requests. You’ll need to set up firewalls, two-step or SSH authentication, and intrusion detection. And then you’ll need to monitor them all.

Managing erratic server load

You’ve also got to be able to handle all the requests that hit your site. If you’re fielding a few hundred requests per second, your basement server will do just fine.

But let’s say that website you created with your basement server takes off, and now you’re running a major business with considerable server load. Because it’s 2006, you scale by renting or buying a room full of servers called a data center. Depending on your server load, your DIY-data center might just be a few machines mounted on racks in your basement. If you’ve gone enterprise, it might be a whole warehouse full of machines. With more servers come greater maintenance and security concerns. You might even need staff—it’s astonishing how quickly maintaining servers can become a full-time job.

Hosting with physical servers also means you’re paying for more hosting capacity than you need. Your data center or server network must be capable of handling the maximum server load to your website at any given time. If yours is like pretty much any other website, your traffic isn’t consistent. It probably spikes during the day and decreases at night. Maybe it’s seasonal, or maybe it shifts on a weekly basis.

With physical servers, your hardware needs to be capable of fulfilling the highest possible number of requests that your site receives. If you underestimate your needs, your site might go down—right when it’s getting the most attention. This means that you’re almost always going to have more server capacity than you need because you’re always prepared to handle the maximum possible number of requests. And that almost never happens.

The advent of cloud computing and virtual machines

Enter cloud computing. The original atomic unit of scale for server power was the server itself. With cloud computing, it became space on a virtual machine, allowing businesses to scale flexibly.

Imagine you started your business in 2015—not 2006. You have a host of cloud computing options to choose from, including Amazon Web Services (AWS), Google Cloud Platform, and Microsoft Azure.

The idea behind all these cloud computing platforms is that you only buy the server space you need, when you need it. If you’re a florist, for example, your website is probably going to get a huge amount of traffic around Valentine’s Day and Mother’s Day. If you were operating out of a data center, you’d need to have enough machines to handle the traffic that slams your site during these holidays. But the rest of the year, those servers are idle. This is a waste of server space, resources, and money. Not only did you have to purchase and power those machines, but also you’re paying for their maintenance, troubleshooting, and security.

Cloud computing was a revolution because it moved the machines out of data centers (and basements) and into the cloud. Of course, those servers still exist, but they are maintained and managed by giant technology companies. You can add server capacity when you anticipate or experience high demand and then decrease it when demand drops.

This means that your flower shop can ramp up its server capacity in anticipation of Mother’s Day. But you’re still estimating your load and still trying to serve the maximum requests without purchasing too many excess machines.

It’s not exact. That’s where serverless computing comes into play.

Cloud computing’s final form: Going serverless

Cloud computing introduced the concept of on-demand web hosting services. But even if you can add and subtract virtual machines with ease, you’re still paying for more server power than you need, because you’re still estimating load capacity.

With serverless computing, you are filling exactly the number of requests you’re getting. No more, no less. And no estimation.

What is serverless hosting?

First of all, serverless is a bit of a misnomer. There are still servers. The difference is that, rather than purchasing space on a fleet of virtual machines to run your programs, the server load is dispersed across the availability of the entire cloud. The server is an abstraction, and the function is king.

In the serverless computing or serverless hosting paradigm, events control when cloud services are requested. Typically, these events are user interactions that make requests of the server. If you’re launching your website in 2018, you can use serverless hosting to spin up server power instantly for every single user interaction. Now, there is a one-to-one ratio of requests fired and server memory tapped to fill them.

If this doesn’t sound like a revolution, keep reading.

What are the advantages of serverless hosting?

Cost considerations

With serverless computing, you can lower your hosting costs by orders of magnitude. For web hosting, $40 a month might not seem like a lot of money. But when that drops to a matter of cents, the savings are astronomical.

Unless you’re fielding tens of millions of consistent requests, serverless computing makes a lot of sense financially.

No maintenance

Serverless computing is all about what you don’t have to worry about. You never have to be concerned with physical server maintenance, upkeep, or security. This burden has shifted to the cloud provider.

Independent instances of code

You also don’t have to worry about any digital infrastructure beyond your code. With serverless execution, each instance runs in its own sandbox, and your virtual machines are all running their own command lines. A single errant script can’t crash your site anymore because they are no longer dependent upon one another. Serverless computing and cloud computing both keep code in containers, and the commands of containers are executed on their own by machines spun up for just for that container. This means you spend less time checking on things because your code works the way you wrote it—the first time, every time.

Serverless hosting incentivizes clean code

If you’re more interested in writing great code than in maintaining a server, there’s another thing you’ll love about serverless hosting. With most serverless platforms, you’re paying down to the millisecond of usage. If your code is clean and efficient, it executes commands more quickly. You’ll actually save money with every instance of good development.

Crash-proof

Okay, nothing is crash-proof. But with serverless computing, you always have the capacity you need to field requests as they happen. Even with cloud computing, it was possible to scale too slowly in the event of a sudden spike. If a celebrity tweets your site and you get slammed with requests, your site could still go down. With serverless, there is neither a lower nor an upper limit to your requests.

Gets going faster

Serverless hosting also makes initial deployment easier. Before serverless, there was still a great deal of excessive scaffolding, when it came to executing applications. Now it’s just a matter of uploading code—not spinning up and configuring servers.

What are some serverless platforms?

AWS Lambda is by far the most popular serverless hosting platform. According to a survey from the Cloud Native Computing Foundation, 70 percent of respondents using serverless tech were on AWS Lambda. Lambda was the first major player in the space, announcing its platform in 2014. Emerging competitors include Google Cloud Functions, Microsoft Azure Functions, and Apache OpenWhisk.

Of course, the true pioneer of serverless was the company Iron.io, a startup founded in 2010 on the principles of serverless, event-based computing. It was Xenon Ventures in April 2017 to create the Fn project, another open source and cloud-agnostic player in the arena.

So what does this mean for bots?

AWS Lambda and other serverless hosting solutions make a lot of sense for many different types of sites and applications. But for bots, in particular, serverless is like an answered prayer.

Why? Because your bot isn’t being used by most site visitors the majority of the time. The bot is the perfect example of a function that only needs to render when invoked. For businesses or hobbyists alike, serverless bot hosting is less expensive and simpler.

If you’re going to create a bot and you want minimal hosting costs with easy deployment and scalability, go serverless. Because it’s 2018, and you finally can.