A lecture to the students of the University College Cork 3rd year Undergraduate Computer Science class, CS3204 (Cloud Infrastructure and Services) on Cloud Native Computing, Microservices, and Serverless computing, on the IBM Cloud. Several examples and a live demo were included. Also contains discussions of the 12-Factor app, and monolith vs. microservice-based applications.
Apidays New York 2024 - The value of a flexible API Management solution for O...
IBM Cloud UCC Talk, 8th December 2020 - Cloud Native, Microservices, and Serverless
1. IBM Cloud
IBM Cloud: Cloud Native,
Microservices, and Serverless
Lecture @ University College Cork
December 8th 2020
Dr. Michael J. O’Sullivan
IBM Hybrid Cloud,
IBM Cork
MichaelOSullivan@ie.ibm.com
2. IBM Cloud
What is IBM Cloud?
IBM Cloud offers the most open and secure public cloud for business, a next-generation hybrid multicloud
platform, advanced data and AI capabilities, and deep enterprise expertise across 20 industries.
https://ibm.com/uk-en/cloud
3. IBM Cloud
What does IBM Cloud provide?
• An open, standards-based cloud computing platform
• Combines Platform as a Service (PaaS) with Infrastructure as a Service (Iaas)
• Includes a Catalog of diverse platform and infrastructure services
• Used rapidly build, deploy, any kind of application, including:
• Web
• Mobile
• Big Data
• New technologies
• Watson
• IoT
• Blockchain
• …
• Integration Tools
7. IBM Cloud
Cloud Service Models
Moving left-to-right, from IaaS to PaaS, the developer manages less…
8. IBM Cloud
How does IBM Cloud work?
End-users access cloud
applications via web browsers
or dedicated mobile apps
Developers create and deploy
applications via web browsers
or command line tools
A router device in the cloud forwards
HTTP(S) requests for applications
to the Virtual Machine (VM) where the
requested application is deployed
The VMs run on physical servers
across IBM Cloud infrastructure
datacenters world-wide
Deployed cloud applications run
in containers. IBM Cloud supports
several platforms providing
containerization. These containers
run on physical servers or VMs that
make-up the data-center.
Shown here is the Cloud Foundry
platform, running containers in
Diego cells, which run on VMs.
9. IBM Cloud
Cloud Computing Environments
Source: http://www.redbooks.ibm.com/redpapers/pdfs/redp4873.pdf
10. IBM Cloud
Example – IBM Cloud Private: A Developer
Cloud Platform
Source: https://www.ibm.com/cloud/garage/architectures/private-cloud/reference-architecture
• On the right, an enterprise
continues to use their
on-premise applications
and data (legacy middleware
and enterprise data)
• In the middle,
IBM Cloud Private
is used to provide a
private cloud
platform to avail of more
services locally within the
enterprise firewall
• On the left, some public
cloud services are also
used for workloads that
may not have as-strict
privacy requirements.
11. IBM Cloud
Cloud Native Computing
“Cloud native technologies empower organizations to build and run
scalable applications in modern, dynamic environments such as
public, private, and hybrid clouds. Containers, service meshes,
microservices, immutable infrastructure, and declarative APIs
exemplify this approach.”
• These techniques enable loosely coupled systems that are resilient, manageable, and
observable
• Combined with robust automation, they allow engineers to make high-impact changes
frequently and predictably with minimal toil.
https://github.com/cncf/toc/blob/master/DEFINITION.md
12. IBM Cloud
What are Cloud-Native Applications?
“Cloud-native is an approach to building and running applications that
exploits the advantages of the cloud computing delivery model.
Cloud-native is about how applications are created and deployed,
not where. ...It’s appropriate for both public and private clouds.
Most important is the ability to offer nearly limitless computing
power, on-demand, along with modern data and application
services for developers...”
Definition from https://pivotal.io/cloud-native
13. IBM Cloud
How to Build a Cloud-Native App?
https://12factor.net/
15. IBM Cloud
Microservices
“Microservices (or microservices architecture) are a cloud native
architectural approach in which a single application is composed of
many loosely coupled and independently deployable smaller
components, or services.”
• Each have their own stack, inclusive of the database and data model
• They communicate with one another over a combination of REST APIs, event
streaming, and message brokers
• They are typically organized by business capability, with the line separating services
often referred to as a bounded context.
https://www.ibm.com/cloud/learn/microservices
16. IBM Cloud
Monolithic App vs. Microservices App
https://www.ibm.com/cloud/architecture/architectures/microservices/
In a Monolith application, one large “Silo” component is used for the whole application, and does everything…
17. IBM Cloud
Monolithic App vs. Microservices App
https://www.ibm.com/cloud/architecture/architectures/microservices/
The Monolithic web-server application (right) is broken up into a series of smaller applications single-purpose applications (left),
each with their own database (i.e., each manages their own data), and fronted with an API Gateway and a frontend service.
18. IBM Cloud
Serverless*
“Serverless is an approach to computing that offloads responsibility
for common infrastructure management tasks (e.g., scaling,
scheduling, patching, provisioning, etc.) to cloud providers and
tools, allowing engineers to focus their time and effort on the
business logic specific to their applications or process.”
• The serverless model requires no management and operation of infrastructure, enabling
developers to focus more narrowly on code/custom business logic
• Serverless computing runs code only on-demand on a per-request basis, scaling
transparently with the number of requests being served
• Serverless computing enables end users to pay only for resources being used, never paying
for idle capacity.
*Of course there is a Server, it’s just invisible to you, the developer!
19. IBM Cloud
Function-as-a-Service (FaaS)
“FaaS is a type of cloud-computing service that allows you to execute
code in response to events without the complex infrastructure
typically associated with building and launching microservices
applications.”
• The physical hardware, virtual machine operating system, and web server software
management are all handled automatically by your cloud service provider
• This allows you to focus solely on individual functions in your application code
• FaaS is a subset of serverless. FaaS, while perhaps the most central technology in
serverless architectures, is focused on the event-driven computing paradigm wherein
application code, or containers, only run in response to events or requests.
https://www.ibm.com/cloud/learn/faas
20. IBM Cloud
Data Processing with FaaS
https://www.ibm.com/cloud/learn/faas
Serverless is well-suited to working with
structured text, audio, image, and
video data around tasks that include
the following:
• Data enrichment, transformation,
validation, cleansing
• PDF processing
• Audio normalization
• Image rotation, sharpening, and
noise reduction
• Thumbnail generation
• Image OCR’ing
• Applying Machine Learning Toolkits
• Video Transcoding.
Upon request from a Client to load 10K images from Cloud Object Storage,
FaaS Actions are invoked and execute in parallel to build a score model.
21. IBM Cloud
Live Demo: Build and deploy Java
Spring Boot microservices on Kubernetes
https://github.com/IBM/spring-boot-microservices-on-kubernetes
An IBM sample application composed of
several components running on a
Kubernetes cluster
It features several polygot microservices
running in Docker containers, and
serverless functions running on IBM Cloud
Functions.
It cloud be considered a Cloud Native
application…
This application, Office Space, mimicks
the fictitious app idea from Michael Bolton
in the movie “Office Space”. The app
takes advantage of a financial program
that computes interest for transactions by
diverting fractions of a cent that are
usually rounded off into a separate bank
account.
22. IBM Cloud
Live Demo: Build and deploy Java
Spring Boot microservices on Kubernetes
https://github.com/IBM/spring-boot-microservices-on-kubernetes
The application uses a Java 8/Spring
Boot microservice that computes the
interest, then takes the fraction of the
pennies to a database
Another Spring Boot microservice is
the notification service. It sends an
email when the account balance
reaches more than $50,000. It is
triggered by the Spring Boot
webserver that computes the interest
The frontend uses a Node.js app that
shows the current account balance
accumulated by the Spring Boot app.
The backend uses a MySQL
database to store the account
balance.
23. IBM Cloud
Live Demo: Build and deploy Java
Spring Boot microservices on Kubernetes
https://github.com/IBM/spring-boot-microservices-on-kubernetes
1. The Transaction Generator service written in
Python simulates transactions and pushes them
to the Compute Interest microservice
2. The Compute Interest microservice computes
the interest and then moves the fraction of
pennies to the MySQL database to be stored.
The database can be running within a container
in the same deployment or on a public cloud
such as IBM Cloud
3. The Compute Interest microservice then calls
the notification service to notify the user if an
amount has been deposited in the user’s
account
4. The Notification service uses IBM Cloud
Functions to send an email message to the user
5. Additionally, an IBM Cloud Function to send
messages to Slack can also be called
6. The user retrieves the account balance by
visiting the Node.js web application frontend
interface.
24. IBM Cloud
Live Demo: Build and deploy Java
Spring Boot microservices on Kubernetes
https://github.com/IBM/spring-boot-microservices-on-kubernetes
The sendEmailNotification serverless function code configured and ready to be called
on IBM Cloud Functions (Block 4 on the diagram on the previous slide)
– it is a Node.js code script that can be called over a public URL (Endpoint)
25. IBM Cloud
Live Demo: Build and deploy Java
Spring Boot microservices on Kubernetes
https://github.com/IBM/spring-boot-microservices-on-kubernetes
Node.js Account Summary Frontend
Webapp, viewed in Web Browser Account Balance
Notification Email from
IBM Cloud Functions
The Docker containers for each Microservice, running as Pods in a Kubernetes Cluster
26. IBM Cloud
Example: Serverless web application and
API (Guestbook)
https://cloud.ibm.com/docs/solution-tutorials?topic=solution-tutorials-serverless-api-webapp
1. The user accesses the application
hosted on the bucket in
Object Storage
2. The web application calls a
backend API
3. The backend API is defined
in API Gateway
4. API Gateway forwards the
request to Cloud Functions
5. The Cloud Functions
actions use IBM Cloudant (database)
to store and retrieve guestbook
entries.
27. IBM Cloud
Example: Mobile Application with a
Serverless Backend
https://cloud.ibm.com/docs/solution-tutorials?topic=solution-tutorials-serverless-mobile-backend
1. The user authenticates against App ID -
App ID provides access and identification tokens
2. Further calls to the backend API include the
access token
3. The backend is implemented with Cloud
Functions. The serverless actions, exposed as
Web Actions, expect the token to be sent in the
request headers and verify its validity
(signature and expiration date) before allowing
access to the actual API
4. When the user submits a feedback, the feedback
is stored in IBM Cloudant (database).
28. IBM Cloud
Example: Mobile Application with a
Serverless Backend
https://cloud.ibm.com/docs/solution-tutorials?topic=solution-tutorials-serverless-mobile-backend
5. The feedback text is processed with
Tone Analyzer (an IBM Cloud Watson Service)
6. Based on the analysis result, a notification is
sent back to the user with
Push Notifications (an IBM Cloud Service)
7. The user receives the notification on the device.
30. IBM Cloud
Links/TutorialsAn introduction to the IBM Cloud - Part 1 (12m 47s)
https://www.youtube.com/watch?v=vLMX9gyTEr4
An introduction to the IBM Cloud - Part 2 (Cloud Foundry: Node app to NoSQL dB) (13m 55s)
https://www.youtube.com/watch?v=OysQX0VwZEY
An introduction to the IBM Cloud - Part 3 (Containers: Node app to NoSQL dB) (20m 50s)
https://www.youtube.com/watch?v=CjqrO14u26g
IBM Cloud Home
https://console.cloud.ibm.com
UCC CS3311 November 2017 Talk on IBM Cloud with Cloud Foundry, Docker, and Kubernetes, by Sanjay Nayak
and Michael O’Sullivan
https://www.slideshare.net/MichaelOSullivan41/ibm-cloud-ucc-talk-22nd-november-2017
Kubernetes: An Introduction to the Open Source Container Orchestration Platform – Talk by Michael O’Sullivan:
https://www.slideshare.net/MichaelOSullivan41/kubernetes-an-introduction-to-the-open-source-container-
orchestration-platform
Further Reading - “Microservices” by Martin Fowler: https://martinfowler.com/articles/microservices.html
Kubernetes: https://kubernetes.io
Red Hat OpenShift: https://www.openshift.com
Cloud Native Computing Foundation (CNCF): https://www.cncf.io