PRIYANKA VERGADIA: Welcome to "Get
Cooking in Cloud," where we share the best recipes
to apply in your cloud kitchen.
I'm Priyanka.
And in this episode, I am pleased to have
Jen Person back with us to talk about another mobile app
backend service solution.
[MUSIC PLAYING]
Good morning, Jen.
Welcome back to "Get Cooking in Cloud."
JEN PERSON: Thanks, Priyanka.
I'm super excited to share today's solution.
I think it's a real winner.
PRIYANKA VERGADIA: So last time you were on the show,
you left us on a bit of a cliffhanger.
You shared a mobile app backend service solution
using Firebase and App Engine standard environment.
My app, Priyanka's Kitchen, uses avatars
in cloud storage for Firebase.
I need a way to create thumbnail versions of larger images.
I'll need to be able to download the full-size image,
scale it, download the scaled version,
and then write back to cloud storage.
That means I will need to write to the file system.
But so far, you didn't recommend the recipe for backend services
that call native binaries, write to the file system,
or make other system calls.
I am really excited to see that solution today.
JEN PERSON: That's right, Priyanka.
In an earlier episode, I explained
that Firebase solves a lot of the mobile app backend
problems.
And last episode, we saw that adding App Engine
standard environment provides a backend service
to modify the synchronized data, filling a gap
in the Firebase-only solution.
But as you pointed out, App Engine standard environment
cannot solve every problem.
For your image thumbnail example,
we definitely need a different solution.
Are you ready to see it?
PRIYANKA VERGADIA: I am waiting with bated breath.
Let's cook it up.
JEN PERSON: So again, here's our recipe from the last episode.
And here's today's recipe.
That's right.
In this design pattern, we still use
Firebase for all its mobile app backend benefits.
But instead of App Engine standard environment,
we use App Engine flexible environment.
PRIYANKA VERGADIA: I notice that the ingredient here
is the same--
App Engine.
And this looks very similar to last episode's recipe,
but it differs in an important way, right?
JEN PERSON: Yes.
PRIYANKA VERGADIA: Like App Engine standard environment,
App Engine flexible environment is
an app platform that monitors, updates, and scales
the hosting environment.
All you need to do is write your mobile backend service code.
Those features are the same.
Where App Engine standard and flexible environment differ
is that flexible environment runs your backend service
inside a Docker container that you can configure.
JEN PERSON: Exactly.
And this means that you can call native binaries,
write to the file system, and make other system calls--
all the things you can't do an App Engine
standard environment.
So if your app needs to process user data or orchestrate
events, extending Firebase with App Engine flexible environment
gives you automatic real-time data synchronization
without needing to run your code inside the App Engine sandbox.
PRIYANKA VERGADIA: So this solution is obviously
a bit more flexible.
JEN PERSON: Yep.
As the name implies, the App Engine flexible environment
will give you more flexibility.
This is a great solution for Firebase apps
that need a backend service to modify the synchronized data.
And that service requires a custom server configuration
or third-party libraries that aren't supported by App Engine
standard environments.
PRIYANKA VERGADIA: Are there any other benefits
to the flexible environment?
JEN PERSON: There is one more.
You may recall that the App Engine standard environment
only holds a connection open for two minutes.
Well, App Engine flexible environment
can hold a connection open for 24 hours.
So for example, you can use this architecture
for backend services that require a persistent connection
to Firebase to receive notifications of data changes.
PRIYANKA VERGADIA: I can totally see how that would be useful.
JEN PERSON: Definitely.
And since you can write to the file system,
you can use this recipe to generate thumbnails
for Priyanka's Kitchen.
PRIYANKA VERGADIA: Well, that's all for today
on "Get Cooking in Cloud."
Jen, thank you so much for coming on the show.
If you would like to know more about today's recipe,
you can check out the Firebase and App Engine guides,
reference docs, the code samples on GitHub
and the Firebase YouTube channel.
JEN PERSON: And if you like this video,
then check out the other episodes in the series.
Don't forget to subscribe to our channel
so you can be notified about new episodes of "Get
Cooking in Cloud," as well as other great Google Cloud
content.
[MUSIC FADING OUT]