{"id":14050,"date":"2018-06-05T00:00:00","date_gmt":"2018-06-05T05:00:00","guid":{"rendered":"https:\/\/centricconsulting.com\/post\/serverless-computing-details-and-benefits_miami-cloud\/"},"modified":"2021-12-15T00:15:05","modified_gmt":"2021-12-15T05:15:05","slug":"serverless-computing-details-and-benefits_miami-cloud","status":"publish","type":"post","link":"https:\/\/centricconsulting.com\/blog\/serverless-computing-details-and-benefits_miami-cloud\/","title":{"rendered":"Serverless Computing: All The Details and Benefits"},"content":{"rendered":"

This article explores the latest trend in cloud computing: serverless.<\/h2>\n

The name itself is a bit of a misnomer, as servers are a critical component of any cloud application and aren\u2019t going away anytime soon.<\/p>\n

However, the ways a server is deployed can vary and along with those variations come a wide range of costs.<\/p>\n

Serverless computing aims to tackle two primary issues with cloud computing: streamlining the tasks associated with deploying a server and reducing the costs associated with running a server.<\/p>\n


\n

Cloud Computing: Before<\/h2>\n

Before diving into the deep end on serverless, it\u2019s worth exploring how we got here. The first computer was connected to a network back in the 1960s. Soon thereafter, IBM introduced the client-server age by offering clients access to their OS\/360 mainframe for a yearly service fee. Around the same time, computer scientists working under a U.S. Department of Defense grant began creating a network of computers called ARPANET or DARPANET, if you want to be extremely accurate. ARPANET gradually evolved into the network we all know and love today as the Internet.<\/p>\n

Fast-forward to the late 1990s. By then most companies had deployed some form of client-server enterprise application. However, the costs of setting up, deploying, and maintaining those servers were expensive in terms of money and time. This typically involved a network administrator, a systems engineer, and a data center housing all the equipment.<\/p>\n

A few companies realized that once the server was configured properly, deployment was relatively straightforward. Furthermore, it was possible to emulate a computer system in software, known as virtualization<\/i>. So they devised a way to create a copy of a server so that it could be cloned repeatedly, following the same exact configuration steps. These copies (also known as virtual machines<\/i> or VMs<\/i>) could be created as needed, say for disaster recovery if a primary server failed. This allowed a server to be set up and deployed much faster and became standard practice for most corporate server deployments.<\/p>\n

The costs came down too as the system components became commoditized and virtualization eliminated the need for specialized hardware. The task of setting up and deploying the server was still a very specific skill and required access to the data center where the server was kept.<\/p>\n

Cloud Computing: And After<\/h2>\n

The next phase of cloud computing was characterized by a few key developments. Storage of data in the cloud became very inexpensive. Services like Dropbox, Google Drive, Apple iCloud were created and allowed users to store digital content such as music, pictures, documents, and spreadsheets up in the cloud and retrieve that content for little or no cost.<\/p>\n

Smartphones also appeared around this same time, allowing users to access the cloud from virtually anywhere, driving the need for even more access to cloud services. As apps like Facebook, Amazon, and Twitter drove more traffic to cloud servers, developers needed to quickly create servers to process all of the traffic.<\/p>\n

However, once those servers were created, the utilization would vary wildly. A server handling Twitter traffic might be idle for most of the day; but if a major news story hit the wire, the server would quickly spike and possibly become overloaded.<\/p>\n

If you provisioned a server based on the high water mark or past traffic, you would likely pay for too much utilization. If you provisioned for the average traffic, you might be swamped by an unexpected event.<\/p>\n

And finally, several cloud providers appeared, such as Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Services, to help make the process even simpler. All of this brings us to the doorstep of serverless computing.<\/p>\n

What is Serverless Computing?<\/h2>\n

As is typical in technology, a crisp definition of a buzzword is often hard to come by. Serverless Computing is no different.<\/p>\n

In fact, a lot of people drop the term \u201ccomputing\u201d from Serverless Computing and just call it Serverless<\/i>, causing even more confusion. I have no doubt that my definition of serverless will be slightly different from yours.<\/p>\n

Amazon\u2019s Lambda service describes serverless in this way: \u201cRun code without thinking about servers.\u201d<\/p>\n

All of the definitions have some of the following traits in common. Serverless is characterized by:<\/p>\n

    \n
  • Dynamically managed resources\n
      \n
    • You don\u2019t provision the server yourself, you simply write the code and the resources are automatically provisioned to accommodate your code<\/li>\n<\/ul>\n<\/li>\n
    • Pricing based on the actual amount of resources used\n
        \n
      • You only pay for what you use, not for a server that\u2019s idle 99% of the time<\/li>\n<\/ul>\n<\/li>\n
      • Scaling of resources done automatically\n
          \n
        • In addition to automatic provisioning, serverless platforms will also scale resources up or down according to usage<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n

          Why Serverless?<\/h2>\n

          The two main drivers for why serverless was created are cost and complexity.<\/p>\n

          First, figuring out how to provision a server, also known as capacity planning, is very difficult. Capacity planning usually results in overspending since it is easier to have excess capacity than to be hit by a surge in demand and lose customers. This means that companies are spending too much on their servers.<\/p>\n

          And second, developers don\u2019t want to spend days or weeks configuring a server. They want to write code to create apps using those servers.<\/p>\n

          Several of the cloud providers began addressing these two issues, starting with Amazon\u2019s Lambda service around 2014. Lambda allows developers to write (server) code that is triggered when an event occurs; but the code does not need to be always running on a server.<\/p>\n

          Instead, the server instance is created dynamically when needed (or triggered), usually in response to an event, such as a web service request. More importantly, the server instance is stopped as soon as the code finishes executing, reducing the cost in theory\u2026more about the theory and reality in a later section.<\/p>\n

          Both Microsoft and Google have competing serverless offerings that work in much the same way as Lambda. Microsoft\u2019s offering is called Azure Functions, while Google\u2019s version is called Cloud Functions. Not very creative, but I\u2019ll take function over form every time!<\/p>\n

          Who does Serverless Computing Impact?<\/h2>\n

          If you\u2019re a systems engineer and have never heard of serverless, you might be in a panic right about now; thinking that serverless will eliminate your job. Not true. On the contrary, serverless will free up system engineers to do other (read: more important) tasks rather than having to configure yet another server for that pesky cloud app.<\/p>\n

          If you\u2019re a mobile developer, you might be thinking, \u201cFinally, I don\u2019t have to wait for the systems engineering team to set up my server!\u201d This is mostly true. One of the key factors driving serverless is the simplicity of setting up the environment to run code in response to an event.<\/p><\/blockquote>\n

          If you\u2019re a full stack developer, you can already do everything by yourself, so serverless will be just another arrow in your quiver. Much like the previous two roles, serverless will make the life of a full stack developer easier. All kidding aside, serverless affects all three of these roles and several others.<\/p>\n

          Finance: The Unexpected Benefit of Serverless<\/h2>\n

          One example where serverless will have an unexpected benefit is in the finance department of your company. More and more companies are moving their servers away from traditional data centers and onto cloud platforms such as AWS and Azure. One of the drivers for this migration is total cost of ownership or TCO for short. The TCO of a cloud platform is usually lower (and in some cases a lot lower) than hosting servers in a data center or co-location center.<\/p>\n

          Furthermore, the costs associated with data centers are treated as a capital expenditure or CapEx if you want to sound like one your finance colleagues. CapEx brings along fun concepts such as depreciation, amortization, and sunk costs, to name a few.<\/p>\n

          Whereas, most cloud costs are treated as an operational expenditure or OpEx, which is much easier to manage from a fiscal point of view, a monthly expense is essentially no different than rent for office space. This fact obviously brings a smile to the face of any chief financial officer and anyone else in within the finance department of an organization.<\/p>\n

          In short, the financial role views serverless as a way to save time and money.<\/p>\n

          How does Serverless work?<\/h2>\n

          At its core, serverless frameworks work by dynamically creating resources in response to a trigger. The framework then invokes the code associated with the trigger; and, finally, the framework shuts down the resources once the code finishes running. The details of how this happens differ depending on the platform.<\/p>\n

          For example, Lambda allows a developer to associate various triggers, such as change to a database or an inbound HTTP request. Each platform also varies in terms of the programming language(s) supported and the permissions afforded to the running code.<\/p>\n

          At the time of writing, here are the languages supported on each platform:<\/p>\n

            \n
          • AWS Lambda\n
              \n
            • js \/ JavaScript<\/li>\n
            • Java<\/li>\n
            • Python<\/li>\n
            • PHP<\/li>\n
            • C#<\/li>\n
            • Go<\/li>\n<\/ul>\n<\/li>\n
            • Microsoft Azure Functions\n
                \n
              • js \/ JavaScript<\/li>\n
              • C#<\/li>\n
              • F#<\/li>\n
              • Python<\/li>\n
              • PHP<\/li>\n<\/ul>\n<\/li>\n
              • Google Cloud Functions\n
                  \n
                • js \/ JavaScript<\/li>\n
                • Go<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n

                  When should you use Serverless?<\/h2>\n

                  There\u2019s a saying among carpenters that goes something like this \u201cif all you have is a hammer, everything starts to look like a nail.\u201d The point of this adage is that it is just as important to know when to use a tool, as it is how to use the tool.<\/p>\n

                  When applied to serverless, there are plenty of times when this technology is appropriate; however, there are times when it actually makes things worse.<\/p>\n

                  Let\u2019s look at some examples and counter-examples.<\/p>\n

                  You should think about using serverless when:<\/p>\n

                    \n
                  • Doing a proof-of-concept; very easy to get started and fail fast if necessary<\/li>\n
                  • Developing a brand new application with server needs; no legacy code to worry about<\/li>\n
                  • Creating a microservice; great for small, self-contained tasks<\/li>\n
                  • Capacity Planning for an application; scalable and robust<\/li>\n
                  • Budgeting for cloud servers; pay for what you use, not idle time<\/li>\n<\/ul>\n

                    You should think twice about using serverless when:<\/p>\n

                      \n
                    • Porting a large client-server app from older technology; platform may not support the programming language or technology used previously<\/li>\n
                    • Supporting a long-running task; batching a large dataset may actually cost more<\/li>\n
                    • Relying on \u201clocal\u201d operations between tasks; no guarantee two tasks will be run on the same server<\/li>\n<\/ul>\n
                      \n

                      Bringing it all together<\/h2>\n

                      Hopefully, by now I\u2019ve convinced you that serverless computing is a trend worth following. To drive the point home, let\u2019s take a look at an example of an application I converted from a traditional server app to serverless.<\/p>\n

                      My initial application is an Amazon Alexa Custom Skill. The server part of this application is a .NET web service written in C#. The web service performs a query on a database using parameters provided by the user when asking Alexa a question.<\/p>\n

                      Because of the way Alexa works, the server hosting the web service must be running at all times. Otherwise, a user\u2019s request might not be handled. The diagram below shows the flow of data within the application.<\/p>\n

                      Focus on step 3, as this is where the server processes the request from Alexa.<\/p>\n

                      \"\"<\/p>\n

                      The server code in my web service is pretty basic C# code to query a SQL database and return a string formatted for Alexa. Keep in mind, the server must be running at all times, regardless of how many customers are using my Alexa service, which in my case can probably be counted on two hands.<\/p>\n

                      In other words, my server is idle most of the time, wasting valuable resources (i.e. my money). What if I could take that same C# code and process any incoming Alexa requests on demand, without a dedicated, always running server?<\/p>\n

                      As luck would have it, AWS provides this capability in the form of Lambda; in fact they prefer it for Alexa skills! (An Alexa Skill is the technical term for the code that enables Alexa to interact with users in a specific way).<\/p>\n

                      With the click of a few buttons in the AWS console, I can set up a trigger (in this case an Alexa request) to launch my C# code to process the request as before and return a response. No code change, just upload the code from my current server application into the Lambda container within AWS.<\/p>\n

                      Here\u2019s what that looks like in AWS:<\/p>\n

                      \"\"<\/p>\n

                      \"\"<\/p>\n

                      Now, I don\u2019t have to worry about maintaining security updates on my server, or providing a backup if the server goes down, or scaling up the resources if I get a sudden spike in traffic to my Alexa skill.<\/p>\n

                      And I certainly don\u2019t have to worry about wasting money on a server that is mostly idle waiting for an occasional request. All of that is done for me by Lambda. All I have to worry about is making sure my code works!<\/p>\n


                      \n

                      Serverless will continue to gain traction as companies like Amazon, Microsoft, Google, and others continue to evolve the technology. Depending on where you and your company are at with cloud adoption, there are a number of ways that Serverless can be leveraged on that journey.<\/p>\n

                      Here is a Top 5 list of ways Serverless can help you:<\/p>\n

                        \n
                      1. Run your code without thinking about servers<\/li>\n
                      2. Lower your total cost of ownership (TCO) for Cloud<\/li>\n
                      3. Decouple your applications using microservices<\/li>\n
                      4. Make your applications scalable and robust<\/li>\n
                      5. Free up your teams to innovate faster and try new things<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"

                        This article explores the latest trend in cloud: serverless computing. It aims to streamline tasks and reduce costs of running a server.<\/p>\n","protected":false},"author":63,"featured_media":17699,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_oasis_is_in_workflow":0,"_oasis_original":0,"_oasis_task_priority":"","_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","footnotes":""},"categories":[1],"tags":[18527],"coauthors":[15012],"acf":[],"publishpress_future_action":{"enabled":false,"date":"2024-07-21 21:41:37","action":"change-status","newStatus":"draft","terms":[],"taxonomy":"category"},"_links":{"self":[{"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/posts\/14050"}],"collection":[{"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/comments?post=14050"}],"version-history":[{"count":0,"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/posts\/14050\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/media\/17699"}],"wp:attachment":[{"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/media?parent=14050"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/categories?post=14050"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/tags?post=14050"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/centricconsulting.com\/wp-json\/wp\/v2\/coauthors?post=14050"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}