Reflections on Teaching Serverless and Cloud-native Application Development

With the proliferation of hybrid cloud, cross-cloud and post-cloud environments, finding the right concepts and tools to produce mixed-technology applications and services remains challenging. At Zurich University of Applied Sciences, a course on Serverless and Cloud-native Application Development (SCAD) prepares bachelor students in computer science for facing these challenges. We argue that this is the first such lecture in Switzerland and probably even in the world. Three years after reflecting on Internet Service Prototyping teaching, this mid-semester blog post sums up the evolution of the field, explains the course design of SCAD and briefly reports on the lab results.

Course Context

Going cloud-native is an ongoing trend for businesses around the world. Marked with big conferences and smaller events, the question for application developers boils down to: How do I design, implement, compose, test and deploy the application in a way that it optimally executes under the given plethora of hosting models in clouds and future post-cloud systems? How do I cope with the service orientation inherently required for discoverable and re-usable event-driven functionality? How do I ensure that platform capabilities around elastic scalability, true pay-per-use billing, low latency invocation, microservice lifecycle management and differentiated storage are fully exploited in my software structure?

This course enables bachelor students to seek appropriate answers to these questions from an application developer perspective by walking them through the topics and supplying them with various cloud resources which can be combined so that multi-cloud and cross-cloud applications emerge. The evolution of technological capabilities requires trade-offs with simplicity which are hard to be conveyed on slides alone. Through practical lab sessions, they are experienced first-hand.

It is inspiring to see how technological progress allows for turning theoretic topics into action. A few years ago, teaching on workflows in service-oriented systems was mostly confined to BPEL, a heavy-weight service orchestration approach which never really made it into practice beyond few selected enterprise systems. Nowadays, composing cloud functions into serverless workflows is relatively easy and something students can try out within minutes. Other topics, such as microservice artefact quality analysis, remain research-centric but may also become standard tooling in a few years. Thus, the Service Prototyping Lab at Zurich University of Applied Sciences remains committed to transfer research results into practice and into education.

Course Structure

Week 1: Mastering Clouds. In the first week, our students learn about various paths into the digital world, in particular into mixed-technology cloud platforms. In between computing paradigms and a brief introduction into service orientation along with service ecosystems, students better understand the fuzzy positioning of cloud-native, serverless and FaaS.

In the hands-on lab part, they dive deeper into the FaaS world and experimentally observe the behaviour of commercial FaaS runtimes, including memory and duration limits, cold starts and the influence of function code size and memory allocation.

Investigated by students P. Weber & M. Jung: ‘There seems to be a warmup effect. The function call is slightly faster on repeated calls and speeds up markedly once the interval gets down to 10s. There is one outlier midway through the data. The slowdown at the very end is due to sending / recieving multiple requests in a matter of milliseconds.’

Week 2: Serverless Applications. Students learn about serverless computing paradigms, FaaS and BaaS combinations, cloud functions as non-standardised programming/packaging/deployment/execution models, and higher-layer application models such as SAM. Beyond technical aspects, the distinct lack of a Swiss/European-based commercial offering is discussed. This fits our strategy as we do not only help local companies with science-based innovation directly, but also indirectly with the supply of technically capable alumni.

Week 3: Serverless Development. After an overview about development processes and tools, the first major focus is on FaaSification tooling and related overlay techniques such as PyWren and Gee’s Lambada. Function tainting and monads are introduced as important concepts for function calling other functions. Deployment frameworks, mock tools and debugging approaches are also presented in this context. In the hands-on lab, students develop simple cloud functions as web actions with database connection to persist form contents.

Week 4: Serverless Workflows. Different workflow concepts, systems and languages are presented, ranging from conventional workflows like Montage, and their adaptations to serverless environments, to new approaches like Step Functions, IBM Composer and Fission Workflows. The performance characteristics including interference of cold starts, instance pool exhaustion and instance migration between VMs are elaborated on along with the overhead, but also the potential advantages, of using workflow managers. The optimisation of workflow execution with techniques such as horizon-based pre-warming is discussed. A TODO manager application is presented as in-depth scenario. In the practical lab, students write their own mini-workflow manager which can handle sequences of functions chained together, and experience the characteristics of running the manager as a function itself.

{     
  "result": {
    "name": "[workflow] ~ Workflow manager || F1 || F2",
    "message": "[okey] ~ Started workflow manager || Call F1 || Call F2"
  },
  "statistics": [
    {
      "name": "f1",
      "result": 2024
    },
    {
      "name": "f2",
      "result": 2024
    },
    {
      "name": "Workflow manager",
      "result": 4049
    }
  ]
}

Investigated by students L. Germann, M. Goetschi and A. Parenti: ‘We see that with the prewarm flag set to true, we get almost identical speed measures. A possible explanation for that behavior is that we call the functions all the time, even if prewarm is set to true…’

Week 5: Serverless Use Cases. Computer science boredom, begone! After having seen all the theoretic concepts to build serverless applications, students experience actual business use cases, many of them with a regional context. Examples are given for Homegate‘s cloud function workflows for real estate listings and in detail for Locize‘s application architecture, apart from the scientifically scrutinised chat bot, energy management and video encoding examples. File management and multi-cloud management with cloud functions are presented as well, relating to our previous research in conjunction with companies in Switzerland. In the lab part, students start building their first cloud function-based and FaaS-hosted application, fulfilling at least four out of seven requirements:

  • Using a deployment framework, like the Serverless Framework or Claudia.js (or just plain Terraform in one case)
  • Using a workflow manager, either a hosted commercial system or a self-hosted one.
  • Stateful processing with a message queue or database.
  • Inter-process communication with a long-running rendezvous server, inspired by the Ex.camera design.
  • FaaSification with Lambada, Termite & Co.
  • Self-optimisation by injecting calibration logic, such as processing tasks closer to the 100ms billing boundaries.
  • Content triggering from the backend services.

Week 6: Serverless Patterns and Pitfalls. Going back to the technical details after the broad use case presentations, the patterns, antipatterns and (not so intuitive) pitfalls are studied. Owing to the similarities with software design patterns, serverless patterns such as ‘data transformation’ and ‘state machine’ are names that are understood by the respective developer community and thus provide a common language, workspace, implementation and foundation. More complex patterns such as ‘event-condition-action’, ‘forward’ and ‘retry’ are important in this context as well, as evidenced by the need to introduce client-side (i.e. function-side) workarounds due to the serverless trilemma inherent to today’s FaaS systems. Antipatterns are more folklore-/rule of thumb-based, but nevertheless their consideration contributes to proper serverless and cloud-native application designs.

Week 7: Containerised Applications. To complement short-running functions, there are multiple techniques to achieve long-running application delivery. PaaS is one option – similar to FaaS, developers submit their code and, especially in conjunction with GitOps, care less about how it is deployed and executed. As the number of supported programming languages, frameworks and protocols in FaaS/PaaS is limited, CaaS is another, more flexible but also more effort-intensive option. Developers create and maintain instructions to build container images which contain complex application parts or even, when departing from the microservices style, complete applications. Students use the lab to create and deploy their own container images and to complement their previously created application with a long-running component.

Weeks 8-14 summary: The second half of the semester is still ahead of us. The lectures generalise cloud function implementations and container images into implementation artefacts, cover their statically and dynamically assessable quality aspects, shed light on dependencies between microservices, look at scalability and quality aspects in general, and touch on messaging and coordination in multi-cloud environments.

Course Resources

To meet the requirements of future employment as engineers (and hopefully in some cases as future master students), access to ready-to-use cloud platforms is indispensable in this course. The access will vary from year to year, but will always consist of a mix of global cloud platforms and local offerings. This year, we provided accounts to the IBM Cloud, the Google Cloud and APPUiO. None of these offers require a credit card, which is another essential factor for studying and exploring. Platform resources are used until certain quotas are hit. Concerning user management, the IBM offer is great for self-management and dynamic addition of students (e.g. late arrivals until two weeks after the start, or thesis students). The Google and APPUiO offerings work on vouchers which are also easy to request.

Additionally, student teams of two (sometimes three) use a university-provided Git service to maintain their code and configuration files. A closer connection between Git and the deployment is an area of potential improvement for the FaaS offerings, but also for some other cloud services, to reduce turnaround times and to avoid code inconsistencies. Documentation on advanced features such as web actions is also lacking; the corresponding tasks are still causing an unnecessarily high cognitive load with students. Nevertheless, the paths from idea to hosted application have been shortened a lot with contemporary cloud engineering approaches.

Overall, the course contributes to a modern and attractive computer science curriculum at Zurich University of Applied Sciences and increases the long-term competitiveness of local industry with skilled engineers. Students and instructors have fun playing with cloud-native application technologies, some already established, others bleeding edge research output.


Leave a Reply

Your email address will not be published. Required fields are marked *