Explainer: What Is Serverless Architecture? Lizzie KardonNovember 9, 2018February 25, 2019 Web hosting has evolved. Say hello to serverless hosting.In the old days, there was only shared hosting. Typically very inexpensive, its primary feature is that hundreds or thousands of websites are packed onto a single server, with each site getting a share of the available resources. Its biggest drawback? Poor security and the “noisy neighbor” effect.Then came VPS hosting, which was a dramatic improvement. Dedicated CPU and enhanced security drove adoption as users sought out dedicated resources and better security and performance for their websites.Now, there’s serverless hosting. It’s the latest incarnation of “the cloud” and is quickly becoming the go-to technology for businesses looking to scale, with big brands like Netflix, Nike, and Airbnb already taking advantage of its server management, extreme scaling, and sub-second metering.But what is serverless? And how on earth does it work without servers?Let’s take a look at how this emerging architecture is allowing developers to focus on code, not infrastructure.What Is Serverless?First up, the name “serverless” is somewhat of a misnomer. Just like wireless internet has wires somewhere, serverless architecture has servers somewhere, too.What “serverless” actually means is that, as a developer, you don’t have to deal with the infrastructure side of building an application. Your application still runs on servers, but you no longer have to provision, scale, and maintain servers to run it—you leave all of that to your serverless provider.As the folks at Serverless.com explain:“Serverless has become a movement about developer empowerment. As a technology, it abstracts away the most menial parts of building an application, leaving you free to actually spend your days coding.”In a nutshell: deploy the application, and go.Let Amazon explain it in this quick video.Serverless is still in its infancy as a technology and there’s still some confusion around what it is. Essentially, it encompasses two different but overlapping areas:Backend as a Service (BaaS) – Applications that significantly depend on third-party services.Function as a Service (FaaS) – Custom code that’s run in ephemeral containers.Amazon introduced the world to FaaS when it launched AWS Lambda in 2014. Since then, Microsoft, Google, and IBM have followed suit with their own offerings. But Lambda is by far the most mature and widely used serverless platform.For the remainder of this article, we’ll focus on FaaS since it’s the most popular implementation of serverless.How Does Serverless Work?The fundamental idea behind serverless architecture is that server-side applications are broken up into individual functions that each perform a distinct task and can be invoked and scaled individually.Writing software as a collection of functions is super basic—every CompSci 101 student learns how to program this way. But what serverless architecture does is take this concept to the extreme.The entire application is split into separate, loosely coupled components that can be operated at any scale. When you upload your code, your serverless provider takes your stateless functions and runs them in parallel, isolated containers that can be monitored and scaled separately.You don’t need to worry about container orchestration, OS configuration, or the underlying servers or security. Just upload your code and run your function.As Augustin Jose explains, serverless has evolved to be the ideal solution for apps running in the cloud:“There is no perpetual process of running and waiting for HTTP requests or API calls, but rather, only an event mechanism to help trigger code execution on any of the cloud servers; the provider defines the event type.”Functions have to be called in response to predefined events and triggers; they don’t start themselves but can be set up to start manually, or upon request. Developers write code only when a certain event needs to take place–the cloud provider takes care of the rest.To illustrate, here’s how AWS Lambda’s serverless solution works:Image: AWS LambdaA good example of a serverless architecture working well is the processing of data immediately after an upload, such as The Seattle Times’ real-time creation of image thumbnails for viewing on different devices.Traditionally, each image would first be sent to the app developer’s server, parsed, and then made available for display on different devices. This method works fine for small numbers of simultaneous users, but what about the newspaper’s 7 million unique visitors a month? Suddenly, simple image resizing becomes a sluggish nightmare.Serverless easily solves this problem. The developer writes a function that resizes images in 10 different sizes. The serverless provider wraps the function into a container that can be monitored, cloned, and distributed on any number of servers. The developer then routes all image resizing to the provider, who simply runs more containers as necessary to ensure the logic will work at any scale.Serverless WordPress: The Future of WordPress?NorthStack is the first truly serverless WordPress Hosting Solution.But let’s take a step back for a moment to talk about so-called “serverless” WordPress, aka static websites.Back in 2016, Shifter emerged as the first “serverless” solution for WordPress. It promised pseudo serverless hosting: in one click your site could be converted into static HTML files, moved to Amazon S3, and delivered via CloudFront.Then HardyPress came along in 2017, promising a similar solution that also converted WordPress sites into static files for “serverless” hosting on AWS infrastructure.Here’s how these so-called serverless WordPress solutions work:Launch a new WordPress site using the Shifter or HardyPress dashboard.Import an existing site or create a new one.Generate a static version of your site.Deploy and go live.Both these services offer the security, speed, and elasticity of serverless hosting. But it’s not truly “serverless.”Shifter and HardyPress are essentially static site generators that strip away the dynamic elements that make WordPress the powerful content management system that it is today. Customers get a somewhat lifeless static version of their WordPress site.To give you an example, AWS architect Yan Cui, aka The Burning Monk, has detailed how he hosts his WordPress site with Shifter. Using Shifter’s “serverless” solution, his static site is fast, but he’s had to sacrifice dynamic elements like search and comments.NorthStack delivers truly serverless WordPress hosting that maintains all the dynamic and interactive features that make WordPress great.NorthStack offers managed application hosting built on a modern serverless AWS stack. You can deploy vanilla or headless WordPress, Node, and even static sites with ease. Your CPU, database, data transfer, and disk usage are independently metered and elastically autoscaled.Here’s how it works.Use NorthStack’s pre-packaged docker containers to easily create and package your application.Specify build scripts (webpack, Grunt) and health checks to run during atomic deployments.Elastic Autoscaling means you always have the power you need and only pay for what you use.NorthStack’s innovative serverless architecture runs on AWS—the established leader in cloud computing—and is backed by Pagely’s 10 years of experience specializing in high-demand managed WordPress hosting. It’s the optimum environment for any WordPress site—big or small.NorthStack is currently best suited for developers and technically savvy users. Pricing is metered and consumption-driven, with paid support options so you only pay for what you use.As Craig Martin, co-founder of Performance Foundry and an early adopter of NorthStack, explains:“Up until now, I’ve never seen serverless WordPress done properly. Many solutions look to create static versions of the WordPress site and just serve that, leading to multiple issues with interactions—like making sales or leaving comments.”“NorthStack’s philosophy matches with ours: high quality infrastructure at a price that meets business objectives.“The future is both autoscaling and serverless. We’re excited.”The Benefits of Serverless Architecture for WordPressFor years, the responsibility of server management has fallen on developers who’ve had to wrangle applications on servers they’ve in turn had to patch, update, and continuously monitor due to all the unexpected errors that can break production.Serverless technology completely flips this paradigm on its head. With serverless, you can take your mind off infrastructure issues and focus on business goals because you can build, run, and test applications without having your own servers. All you need to do as a developer is focus on your code.Ultimately, serverless is about allowing you to focus your efforts on what provides value to your users. No matter what you are building, there are plenty of reasons to go serverless.1. No Servers to ManageServerless technology’s biggest selling point is that you no longer have to manage servers; you no longer need to spend time and resources on server provisioning, maintenance, updates, security patching, scaling, or capacity planning. Instead, all of these tasks and capabilities are handled by your serverless providers and are completely abstracted away from the developer.You can deploy code without provisioning anything beforehand, or managing anything afterward. You just write your code and your serverless provider automatically runs it for you.As AWS Solutions Architects Thyagarajan and Maitreya Ranganath point out, “no server is easier to manage than no server.”serverless architectureOr as developer Joe Hanson points out, it gives developers more time for user experience:“Users don’t care about infrastructure; they care about features and their experience. Serverless architecture allows teams to focus resources on the elements that keep users happy.”2. Extreme ScalabilityEveryone wants their app to be the next big thing. But if you suddenly found you had the next Facebook or Instagram on your hands, could your server handle the load?Provisioning infrastructure just in case is a big risk— but so is being unprepared when success strikes. Serverless architecture means you don’t need to make this choice.One of the biggest advantages of serverless is its extreme elasticity. Its immediate and seamless provisioning of functions means you can scale your application in seconds to handle sudden surges of traffic. The underlying system will automatically handle things such as load-balancing and the provisioning of appropriate infrastructureLikewise, during lulls when there is no demand, you don’t need to have servers running needlessly, waiting for something to happen.With serverless, you don’t need to fire alerts or write scripts to scale up and down— your provider manages scaling challenges for you.A great example of how serverless can scale is A Cloud Guru. In six months, the online training platform scaled to 40,000 users without a single server.3. Disruptively Low CostGoing serverless can save you a ton of money. Because you’re only paying for the time your code is executed and there’s no need for always-on servers, operational costs plummet.There are no costs resulting from idle capacity. With AWS Lambda, for example, you are charged for every 100ms your code executes and the number of times your code is triggered. You don’t pay anything when your code isn’t running.The days of spending tens of thousands of dollars—or more—for servers are gone.Many developers have shared their cost savings since switching to serverless.When developer Ayner Sorek moved his side project —an Express.JS application with 50— 150 daily visits — from AWS Elastic Beanstalk to Lambda+APIG, it resulted in a ~90% reduction of costs.In another example, Mohsiur Rahman from Heavywater writes that his company’s previous infrastructure kept getting more and more expensive over time:“Even with most of our EC2 instances sized as t2.micro, our AWS bills kept increasing. In the span of just 4 months, our monthly bill increased from $10K to $30K with over 1,000 EC2 instances running.”Just by going serverless, their infrastructure costs decreased from $30,000 to $4,000 in just three months.Likewise, serverless architecture has been a game changer for A Cloud Guru. Co-founder Sam Kroonenburg writes that serverless has allowed his team to have an extremely low operating cost base:“We don’t run servers or infrastructure, which means we don’t have to employ people to maintain and monitor them. There are no servers to be patched, no auto-scaling groups to manage, no compute performance metrics to worry about.”He says the team uses a mix of different cloud services, such as AWS, Auth0, and Intercom, and pays monthly fees. This model has enabled A Cloud Guru to deliver training with a disruptively low-cost pricing model and attract a large user base quickly, helping to fuel the platform’s fast growth.4. Faster Time to MarketGot a great idea for your app? Serverless can help you ship it faster.Because there’s less to provision up front and less to manage after deployment, small teams can conceive and build features quickly.Kroonenburg says this “insane speed to market” has helped fuel his company’s growth.“Without having to build a backend, we got to market quickly. Within 4 weeks of starting the build, in fact. This enabled us to get users on the platform early and get their feedback often. It leads us to build a better product… a product that our users could give input to and help to craft.”5. Less Wasted Time and EffortWhen you’re developing a bunch of products, certain features are developed repeatedly. For example, user authentication and payment processing.Serverless, with its use of individual functions, allows teams to develop product services as independent components. These components can then be reused across different projects so developers don’t have to reinvent the wheel, saving time and effort.The Drawbacks of Going ServerlessServerless does bring many benefits to the table. Nonetheless, no single approach or technology is the be all and end all—it all depends on the context of what you are developing.There are some potential drawbacks that might make serverless unsuitable for your business or project.1. Vendor Lock-InA drawback people often point to when talking about serverless technology is vendor lock-in.Providers all have different required formats and deployments methods. Additionally, everything is controlled by the provider, so you don’t have complete control over the usage and management of resources.As Aleksandar Simovic, author of Serverless Applications with Node.js, points out:“Running your applications in a serverless environment can tightly couple your applications and services with your platform provider. Even though your business logic isn’t reliant on the service itself, it still needs a direct connection to the platform provider services. With interface and protocol differences between serverless platform providers ‘in the mix,’ any potential move of your applications to other serverless platforms will be a painful rewrite.”But as Jaikumar Vijayan writes, there’s always a degree of lock-in with any technology choice, and serverless is no different. He suggests businesses should focus on finding and committing to a platform that offers them the most benefits and integrations across provider services.2. Learning CurveDespite the comprehensive documentation and community resources available for getting up to speed on serverless, it’s still in its infancy as a technology and developers might encounter a steep learning curve.It’s a relatively new architecture that does require a mindset shift. And as Dmitri Zimine writes, this means developers reap the cost benefits in return for complexity.“Much of this extra complexity is ‘wiring’: configurations, deployment scripts, DevOps tooling artifacts —templates, recipes, playbooks, Docker files… All the stuff used to forklift the solution up to the cloud, and keep it there.”But as Zimine goes on to write:“The cost-saving benefits of serverless are so clear and so substantial, and the push from all major cloud vendors towards serverless is so strong, that it won’t be long before the complexity is tamed and serverless becomes mainstream in all the areas where it applies.”3. Unsuitable for Long-Term TasksServerless is great for short real-time or near-real-time processes, like sending out emails, resizing images, and transaction order processing.But for long duration operations, such as uploading video files, which can’t be split into multiple compute cycles, you’re better off with “server-full” architecture.AWS Lambda, for example, gives you 5 minutes maximum to execute a task and if it takes longer, you need to call another function.This means that for large-scale data tasks or long-running processing tasks, you might want to consider another architecture or, at least, develop in such a way as to be appropriate, which is possible and can be done.ConclusionServerless technology is really breaking ground in its path to disrupt server infrastructure. Industry-wide adoption is on the rise, driven largely by its low cost and scalability, helping both big brands and startups push applications to market faster while delivering greater value to users.It’s still a relatively young technology—some say it’s in the slightly awkward teenage years—so our understanding of serverless and how to use it is still evolving. No doubt there will be many advances in this technology in the years to come, and it will be fascinating to see how developers adopt and run with it to build better applications for users.November 9, 2018February 25, 2019 Industry News Author Lizzie Kardon Lizzie Kardon is the content marketing manager for Pagely, flexible managed WordPress hosting services for business-critical projects. 0 Comments Cancel reply Comment:Name * Email *Save my name, email, and website in this browser for the next time I comment.