Instant download (Ebook) Practical Spring Cloud Function: Developing Cloud-Native Functions for Multi-Cloud and Hybrid-Cloud Environments by Banu Parasuraman ISBN 9781484289129, 1484289129 pdf all chapter
Instant download (Ebook) Practical Spring Cloud Function: Developing Cloud-Native Functions for Multi-Cloud and Hybrid-Cloud Environments by Banu Parasuraman ISBN 9781484289129, 1484289129 pdf all chapter
com
OR CLICK HERE
DOWLOAD EBOOK
ebooknice.com
https://ebooknice.com/product/cloud-native-development-with-google-
cloud-53721370
ebooknice.com
(Ebook) Cloud Native Spring in Action by Thomas Vitale
ISBN 9781617298424, 1617298425
https://ebooknice.com/product/cloud-native-spring-in-action-47543946
ebooknice.com
ebooknice.com
ebooknice.com
Banu Parasuraman
Practical Spring Cloud Function: Developing Cloud-Native Functions for
Multi-Cloud and Hybrid-Cloud Environments
Banu Parasuraman
Frisco, TX, USA
Acknowledgments������������������������������������������������������������������������������xv
Introduction��������������������������������������������������������������������������������������xvii
v
Table of Contents
vi
Table of Contents
vii
Table of Contents
viii
Table of Contents
Index�������������������������������������������������������������������������������������������������335
ix
About the Author
Banu Parasuraman is a cloud native
technologist and a Customer Success Manager
(CSM) at IBM, with over 30 years of experience
in the IT industry. He provides expert advice
to clients who are looking to move to the cloud
or implement cloud-native platforms such
as Kubernetes, Cloud Foundry, and the like.
He has engaged over 25 select companies
spread across different sectors (including
retail, healthcare, logistics, banking, manufacturing, automotive, oil
and gas, pharmaceuticals, and media and entertainment) in the United
States, Europe, and Asia. He is experienced in most of the popular cloud
platforms, including VMware VCF, Pivotal PCF, IBM OCP, Google GCP,
Amazon AWS, and Microsoft Azure. Banu has taken part in external
speaking engagements targeted at CXOs and engineers, including at
VMworld, SpringOne, Spring Days, and Spring Developer Forum Meetups.
His internal speaking engagements include developer workshops on
cloud-native architecture and development, customer workshops on
Pivotal Cloud Foundry, and enabling cloud-native sales plays and
strategies for sales and teams. Lastly, Banu has numerous blogs on
platforms such as Medium and LinkedIn, where he promotes the adoption
of cloud-native architecture.
xi
About the Technical Reviewer
Manuel Jordan Elera is an autodidactic
developer and researcher who enjoys learning
new technologies for his own experiments and
creating new integrations. Manuel won the
Springy Award 2013 Community Champion
and Spring Champion. In his little free time,
he reads the Bible and composes music on his
guitar. Manuel is known as dr_pompeii. He
has tech-reviewed numerous books, including
Pro Spring MVC with Webflux (Apress, 2020),
Pro Spring Boot 2 (Apress, 2019), Rapid Java Persistence and Microservices
(Apress, 2019), Java Language Features (Apress, 2018), Spring Boot 2
Recipes (Apress, 2018), and Java APIs, Extensions, and Libraries (Apress,
2018). You can read his detailed tutorials on Spring technologies and
contact him through his blog at www.manueljordanelera.blogspot.com.
You can follow Manuel on his Twitter account, @dr_pompeii.
xiii
Acknowledgments
It has been a great privilege to write this book and help you understand
real-world implementations of Spring Cloud Function. Thank you for
reading it.
After my presentation at SpringOne 2020, I received a message on
LinkedIn from Steve Anglin at Apress. Steve asked me if I would be willing
to write a book about Spring Cloud Function. I was a bit hesitant at first,
given that I was occupied with many client engagements, which were
taking up most of my work hours. I was worried that I would not do the
subject justice, due to my preoccupation with my clients. But after a long
contemplation and a heartfelt discussion with my family, I decided to
take it on.
I want to thank Steve Anglin, Associate Editorial Director, for reaching
out to me and providing me this opportunity to write a book on Spring
Cloud Function.
Mark Powers, the Editorial Operations Manager, was instrumental
in helping me bring this book to close. With his incessant prodding and
nudging, he helped me reached the finish line. Thanks, Mark.
Manuel Jordan, the technical reviewer, was immensely helpful. His
comments kept me honest and prevented me from cutting corners. He
helped improve the quality of the solutions that I present in this book.
Thanks, Manuel.
I also want to thank Nirmal Selvaraj and others at Apress, who worked
to bring this book to fruition.
This book would not be possible without the help of my wife Vijaya and
daughters Pooja and Deepika, who provided the much-needed emotional
support through this journey.
xv
Introduction
I entered the field of Information Technology (IT) 25 years ago, after
spending time in sales and marketing. I was an average programmer and
was never into hardcore programming. During my early life in IT, I worked
as part of a team that built a baseball simulator for the Detroit Tigers. I
helped build a video capture driver for that simulator using C++. Even
though this was a great project with a lot of visibility, it was never my real
passion to be a hard-core programmer.
I soon gravitated toward solution architecture. This seemed to
perfectly tie my marketing skills to my technology skills. I began looking
at solutions from a marketing lens. This approach formed the basis for
writing this book. Because, what good is a technology if we do not know
how to apply it in real life?
Functional programming was an emerging technology. Cloud
providers such as AWS, Google, and Azure created serverless
environments, with innovations such as Firecracker virtualization
techniques, that allowed infrastructure to scale down to zero. This allowed
customers to derive huge cost savings by not paying for resources that were
not in use and subscribing to a pay-per-use model.
Initially, development of these functions that run on serverless
environments were built on either NodeJS or Python. These functions
were also vendor-specific. Spring.io developed the Spring Cloud Function
framework, which allowed the functions to run in a cloud-agnostic
environment. The focus was on the “write once, deploy anywhere”
concept. This was a game changer in the cloud functions world.
xvii
Introduction
xviii
CHAPTER 1
compute time. They also can be scaled to fit exact demand, by focusing on
billing for the number of invocations as compared to billing for uptime.
FaaS has two parts, as shown in Figure 1-1.
1.1.1. Implementation
of an Enterprise Application
Imagine all the infrastructure needed to run a single payroll application
on the cloud. This application may consume only 16GB of RAM and eight
vCPUs, but you are charged continuously for the entire duration that the
application is active. Using a simple AWS pricing formula, this works out
to around $1,000 per year. This cost is for the whole time the application
2
Chapter 1 Why Use Spring Cloud Function
If you calculate the billing cost using an AWS cost calculator, you see
that you will spend $1 million per year. This spend is for applications
that are critical and highly utilized, as well as for applications that are
minimally utilized. This cost is due to the fact that the cloud providers
charge for the entire duration the application is active and consuming
the infrastructure. The key here is that the infrastructure is fully allocated
3
Chapter 1 Why Use Spring Cloud Function
for the application’s life. Imagine how much you could save if the
infrastructure was allocated only for the duration that the application
was active and serving. This would be a great cost and resource saving
approach. Cloud providers have thought through this because they also
faced the pressure of finite infrastructure and considered the time needed
to provision additional infrastructure.
4
Chapter 1 Why Use Spring Cloud Function
5
Chapter 1 Why Use Spring Cloud Function
come up and another 15 minutes for the application to come down. This
would not fly. Imagine if you deployed this application to an AWS Lambda
serverless function. Thirty minutes of downtime for each invocation?
This will not work. Your users would abandon the application entirely. As
you can see, large applications cannot benefit from resource release and
resource reassignment because they take a long time to start up and shut
down, which would impact the general operation of the application.
Can you make this large payroll application behave in an expected way
for serverless functions? The answer is yes. A lot of refactoring is required,
but it can be done.
6
Chapter 1 Why Use Spring Cloud Function
7
Chapter 1 Why Use Spring Cloud Function
8
Chapter 1 Why Use Spring Cloud Function
9
Chapter 1 Why Use Spring Cloud Function
You can see that the code and containers both differ from the provider
and are not easily portable.
10
Chapter 1 Why Use Spring Cloud Function
In the discussions so far, you have seen the following issues related
to FaaS:
• Portability of code
11
Chapter 1 Why Use Spring Cloud Function
This is where the Spring Cloud Function comes in. The Spring.io team
started the Spring Cloud Function project with the following goals:
Source: https://spring.io/projects/spring-cloud-function
The key goals are decoupling from a specific runtime and supporting a
uniform programming model across serverless providers.
Here’s how these goals are achieved:
Figures 1-4 and 1-5 show how you can deploy Spring Cloud Function.
When Spring Cloud Function is bundled with specific libraries, it can be
deployed to AWS Lambda, Google Cloud Functions, or Azure Functions.
12
Chapter 1 Why Use Spring Cloud Function
13
Chapter 1 Why Use Spring Cloud Function
14
Chapter 1 Why Use Spring Cloud Function
15
Chapter 1 Why Use Spring Cloud Function
1.4.2. What Is Knative?
Knative is an extension of Kubernetes that enables serverless workloads
to run on Kubernetes clusters. Working with Kubernetes is a pain. The
amount of tooling that is required to help developers move their code from
the IDE to Kubernetes defeats the purpose of the agility that Kubernetes
professes to bring to the environment. Knative automates the process of
build packages and deploying to Kubernetes by provider operators that are
native to Kubernetes. Hence, the names “K” and “Native”.
Knative has two main components:
16
Chapter 1 Why Use Spring Cloud Function
17
Chapter 1 Why Use Spring Cloud Function
18
Chapter 1 Why Use Spring Cloud Function
Using this use case, the following sections explore how you can
leverage Spring Cloud Function to modernize and transform this
application into a highly efficient, scalable, and portable system.
19
Chapter 1 Why Use Spring Cloud Function
Abbreviations: ROSA: Red Hat OpenShift on AWS; ARO: Azure Red Hat OpenShift;
EKS: Elastic Kubernetes Services; AKS: Azure Kubernetes Services; GKE: Google
Kubernetes Engine
20
Chapter 1 Why Use Spring Cloud Function
Now you need to deploy the payroll system on AWS Lambda. The
deployment sequence is important, as you need to deploy SAP ECC and
Oracle before integrating and then configure API and messaging for the
Spring Cloud Function to integrate with SAP. Spring Cloud Function can be
created and tested with dummy information, but it needs to be deployed
after integration testing with SAP ECC:
21
Chapter 1 Why Use Spring Cloud Function
22
Chapter 1 Why Use Spring Cloud Function
23
Chapter 1 Why Use Spring Cloud Function
24
Chapter 1 Why Use Spring Cloud Function
25
Chapter 1 Why Use Spring Cloud Function
26
Chapter 1 Why Use Spring Cloud Function
27
Chapter 1 Why Use Spring Cloud Function
28
Chapter 1 Why Use Spring Cloud Function
29
Chapter 1 Why Use Spring Cloud Function
Figure 1-18. Four-node VxRail P570F cluster for vSphere with Tanzu
and HAProxy
30
Chapter 1 Why Use Spring Cloud Function
31
Other documents randomly have
different content
players. The IBM 704 computer has been programmed to inspect the
results of its possible decisions several moves ahead and to select
the best choice. At the end of the game it prints out the winner and
thanks its opponent for the game. Rated as polite, but only an
indifferent player by experts, the computer is much like the checker-
playing dog whose master scoffed at him for getting beaten three
games out of five. Chess may well be an ultimate challenge for any
kind of brain, since the fastest computer in operation today could not
possibly work out all the possible moves in a game during a human
lifetime!
As evidenced in the science-fiction treatment early machines got,
the first computers were monsters at least in size. Pioneering design
efforts on machines with the capacity of the brain led to plans for
something roughly the size of the Pentagon, equipped with its own
Niagara for power and cooling, and a price tag the world couldn’t
afford. As often seems to happen when a need arises, though, new
developments have come along to offset the initial obstacles of size
and cost.
One such development was the transistor and other
semiconductor devices. Tiny and rugged, these components require
little power. With the old vacuum-tubes replaced, computers shrank
immediately and dramatically. On the heels of this micro-
miniaturization have come new and even smaller devices called
“ferrite cores” and “cryotrons” using magnetism and supercold
temperatures instead of conventional electronic techniques.
As a result, an amazing number of parts can be packed into a tiny
volume. So-called “molecular electronics” now seems to be a
possibility, and designers of computers have a gleam in their eyes as
they consider progress being made toward matching the “packaging
density” of the brain. This human computer has an estimated 100
billion parts per cubic foot!
We have talked of reading and translating. Some new computers
can also accept voice commands and speak themselves. Others
furnish information in typed or printed form, punched cards, or a
display on a tube or screen.
Like us, the computer can be frustrated by a task beyond its
capabilities. A wrong command can set its parts clicking rapidly but
in futile circles. Early computers, for example, could be panicked by
the order to divide a number by zero. The solution to that problem of
course is infinity, and the poor machine had a hard time trying to
make such an answer good.
This printed-circuit card contains more than 300 BIAX memory elements. Multiples
of such cards mounted in computers store large amounts of information.
There are other, quainter stories like that of the pioneer General
Electric computer that simply could not function in the dark. All day
long it hummed efficiently, but problems left with it overnight came
out horribly botched for no reason that engineers could discover. At
last it was found that a light had to be left burning with the scary
machine! Neon bulbs in the computer were enough affected by light
and darkness that the delicate electronic balance of the machine had
been upset.
Among the computer’s unusual talents is the ability to compose
music. Such music has been published and is of a quality to give rise
to thoughtful speculation that perhaps great composers are simply
good selectors of music. In other words, all the combinations of
notes and meter exist: the composer just picks the right ones. No
less an authority than Aaron Copland suggests that “we’ll get our
new music by feeding information into an electronic computer.” Not
content with merely writing music, some computers can even play a
tune. At Christmas time, carols are rendered by computers specially
programmed for the task. The result is not unlike a melody played on
a pipe organ.
In an interesting switch of this musical ability on the part of the
machine, Russian engineers check the reliability of their computers
by having them memorize Mozart and Grieg. Each part of the
complex machines is assigned a definite musical value, and when
the composition is “played back” by the computer, the engineer can
spot any defects existing in its circuitry. Such computer maintenance
would seem to be an ideal field for the music lover.
In a playful mood, computers match pennies with visitors, explain
their inner workings as they whiz through complex mathematics, and
are even capable of what is called heuristic reasoning. This amounts
to playing hunches to reach short-cut solutions to otherwise
unsolvable problems. A Rand Corporation computer named
JOHNNIAC demonstrated this recently. It was given some basic
axioms and asked to prove some theorems. JOHNNIAC came up
with the answers, and in one case produced a proof that was simpler
than that given in the text. As one scientist puts it, “If computers don’t
really think, they at least put on a pretty creditable imitation of the
real thing.”
Computers are here to stay; this has been established beyond
doubt. The only question remaining is how fast the predictions made
by dreamers and science-fiction writers—and now by sober
scientists—will come to be a reality. When we consider that in the
few years since the 1953 crop of computers, their capacity and
speed has been increased more than fiftyfold, and is expected to
jump another thousandfold in two years, these dreams begin to
sound more and more plausible.
One quite probable use for computers is medical diagnosis and
prescription of treatment. Electronic equipment can already monitor
an ailing patient, and send an alarm when help is needed. We may
one day see computers with a built-in bedside manner aiding the
family doctor.
The accomplished inroads of computing machines in business are
as nothing to what will eventually take place. Already computer
“game-playing” has extended to business management, and serious
executives participate to improve their administrative ability. We
speak of decision-making machines; business decisions are logical
applications for this ability. Computers have been given the job of
evaluating personnel and assigning salaries on a strictly logical
basis. Perhaps this is why in surveys questioning increased use of
the machines, each executive level in general tends to rate the
machine’s ability just below its own.
Other games played by the computer are war games, and
computers like SAGE are well known. This system not only monitors
all air activity but also makes decisions, assigns targets, and then
even flies the interceptor planes and guided missiles on their
missions. Again in the sky, the increase of commercial air traffic has
perhaps reached the limit of human ability to control it. Computers
are beginning to take over here too, planning flights and literally
flying the planes.
Surface transport can also be computer-controlled. Railroads are
beginning to use the computer techniques, and automatic highways
are inevitable. Ships also benefit, and special systems coupled to
radar can predict courses and take corrective action when
necessary.
Men seem to have temporarily given up trying to control the
weather, but using computers, meteorologists can take the huge
mass of data from all over the world and make predictions rapidly
enough to be of use.
We have talked of the computer’s giant strides in banking. Its wide
use in stores is not far off. An English computer firm has designed an
automatic supermarket that assembles ordered items, prices them,
and delivers them to the check stand. At the same time it keeps a
running inventory, price record, and profit and loss statement,
besides billing the customer with periodic statements. The
storekeeper will have only to wash the windows and pay his electric
power bill.
Even trading stamps may be superseded by computer techniques
that keep track of customer purchases and credit him with premiums
as he earns them. Credit cards have helped pioneer computer use in
billing; it is not farfetched to foresee the day when we are issued a
lifetime, all-inclusive credit card—perhaps with our birth certificate!—
a card with our thumbprint on it, that will buy our food, pay our rent
and utilities and other bills. A central computer system will balance
our expenses against deposits and from time to time let us know
how we stand financially.
As with many other important inventions, the computer and its
technology were spurred by war and are aided now by continuing
threats of war. It is therefore pleasant to think on the possibilities of a
computer system “programmed” for peace: a gigantic, worldwide
system whose input includes all recorded history of all nations, all
economic and cultural data, all weather information and other
scientific knowledge. The output of such a machine hopefully would
be a “best plan” for all of us. Such a computer would have no ax to
grind and no selfish interests unless they were fed into it.
Given all the facts, it would punch out for us a set of instructions
that would guarantee us the best life possible. This has long been a
dream of science writers. H. G. Wells was one of these, suggesting a
world clearinghouse of information in his book World Brain written in
the thirties. In this country, scientist Vannevar Bush suggested a
similar computer called “Memex” which could store huge amounts of
data and answer questions put to it.
The huge amounts of information—books, articles, speeches, and
records of all sorts—are beginning to make it absolutely necessary
for an efficient information retrieval system. Many cases have been
noted in which much time and effort are spent on a project which has
already been completed but then has become lost in the welter of
literature crammed into libraries. The computer is a logical device for
such work; in a recent test such a machine scored 86 per cent in its
efforts to locate specific data on file. Trained workers rated only 38
per cent in the same test!
—James A. Garfield
2: The Computer’s Past
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com