Image for post
Image for post

Firebase: The Amalgamation of Cloud and Mobile

Cloud computing is a concept that is near and dear to the hearts of many software engineers around the world. Most engineers and researchers intuitively understand what the cloud is, and take it for given. However, as is usually the case with modern IT buzzwords, there is no one universally accepted definition for cloud computing. Here are few definitions that you are likely to encounter in the ether:

  • “Cloud computing is the on-demand delivery of compute power, database storage, applications, and other IT resources through a cloud services platform via the internet with pay-as-you-go pricing.”Amazon Web Services
  • “Cloud computing is an information technology (IT) paradigm that enables ubiquitous access to shared pools of configurable system resources and higher-level services that can be rapidly provisioned with minimal management effort, often over the Internet.”Wikipedia
  • “Clouds are a large pool of easily usable and accessible virtualized resources. These resources can be dynamically reconfigured to adjust to a variable load, allowing also for an optimum resource utilization. This pool of resources is typically exploited by a pay-per-use model in which guarantees are offered by the Infrastructure Provider by means of customized SLAs.” — A Break in the Clouds: Towards a Cloud Definition, Luis M. Vaquero et al, SIGCOMM Computer Communication Review, 2009
  • “A Cloud is a type of parallel and distributed system consisting of a collection of interconnected and virtualized computers that are dynamically provisioned and presented as one or more unified computing resources based on service-level agreements established through negotiation between the service provider and consumers” — Market-oriented cloud computing: Vision, hype, and reality for delivering IT services as computing utilities, Rajkumar Buyya et al, CoRR, 2008
  • “Cloud computing refers to both the applications delivered as services over the Internet and the hardware and systems software in the data centers that provide those services.” — Michael Armbrust et al, Communications of the ACM, 2010
  • “Cloud computing is a form of distributed computing that turns compute infrastructure, programming platforms and software systems into scalable utility services. By exposing various compute and programming resources as utility services, cloud computing promotes resource sharing at scale via the Internet.” — Hiranya Jayathilaka, Governance of Cloud-hosted Web Applications, Ph.D. dissertation, UC Santa Barbara, 2016

Yes, that last one was from my own dissertation. Fortunately, most definitions agree on the key characteristics of cloud platforms (on-demand, scalable, on-line service model etc.). But the differences in wording and emphasis are difficult to ignore.

Apart from the lack of uniformity, there is another problem with the above definitions — they are all quite technical. These are not easily decipherable for a person without some background in computer science, and you definitely cannot share them with your not-so-tech-savvy aunt.

I learned one of the simplest definition of the cloud during my first year at grad school, from a guest speaker. The speaker was Urs Hölzle, SVP of Engineering, and the 8th employee of Google. Urs gave one of the best tech talks I’ve ever heard on the subject, focusing a great deal on the Google Cloud Platform. Here’s his definition, with a bit of paraphrasing thrown in there:

“Mobile apps are increasingly becoming complex and sophisticated, while the devices they run on have limited resources and energy. Therefore their computing and storage needs must be offloaded to something else. Cloud is that something.” — Urs Hölzle, 2013

Finally! A definition that we can run by our grandparents. Most people are intimately familiar with mobile devices and mobile apps. Studies suggest that mobile apps have become a worldwide social and cultural phenomenon. It is easy to understand, even for a layman, that a mobile app would every now and then have to run some computations or store some data in a remote datacenter, aka the cloud. Pretty much every non-trivial mobile app operates this way, and the app users are intuitively aware of the fact. Simply put, this definition describes the cloud in terms of how an average user would interact with it.

However, it is not the simplicity of this definition that I’m going to focus on. It is the message hidden in the definition — the fine print, so to speak, that is my main topic today. Through his definition, Urs describes an important, but often overlooked aspect of cloud computing. Namely, the symbiotic relationship between cloud computing and mobile apps. According to the above definition, the cloud exists primarily to serve mobile apps. And the mobile apps wouldn’t be able to do the fancy things they do without the cloud. Cloud and mobile depend on, and nurture each other.

The idea that mobile and cloud should work together is not a new one. It wasn’t new even when I heard it. Several authors have been writing about it for nearly a decade (e.g. InfoWorld 2014, Forbes 2012, IBM 2011, ReadWrite 2009). But even to this day, it sounds a little out there. Fortunately, the validity of this concept can easily be verified today by looking at some of the more successful mobile apps and cloud platforms in existence. Take Netflix for example — arguably one of the most successful apps in the world, with 100+ million subscribers streaming content on a wide range of devices. And who can blame those subscribers too? I mean, have you watched Stranger Things? Totally worth it!

Coming back to the topic, a main reason why Netflix has been such a technological success is, its reliance on AWS, Amazon’s cloud platform offering. Thanks to the cloud, Netflix has managed to deliver high quality, high available and highly scalable apps to millions, with barely any datacenters of their own. Other cloud platform providers like Google and Microsoft also readily share similar success stories from their biggest customers, most of whom are popular international brands, and have a strong mobile presence. All in all there’s overwhelming evidence to suggest that cloud and mobile are a match made in heaven, and a tried-and-tested formula for building successful apps. With the users on mobile devices starting to outnumber the users on conventional computers, mobile app developers should really take this fact to heart, and leverage the cloud as much as possible to build high-quality, scalable mobile apps for the masses.

Firebase is Google’s mobile platform — a carefully put together collection of curated services, and SDKs for the web, iOS and Android platforms. Together, they make developing high quality apps both fun and easy. And the philosophy that the cloud and mobile apps go hand in hand, is in the DNA of Firebase.

Most app developers that use Firebase, typically start with the backend as a service (BaaS) offerings of Firebase. There are quite a few of those but Firebase Authentication and Realtime Database are the frequent picks. These services are designed to simplify how mobile apps store data and run computations in the cloud. Developers would also notice that each Firebase project is in fact a Google Cloud Platform (GCP) project in disguise. This makes it easy to consume GCP services in a Firebase app. For instance, lets say you’re building a photo album app, and in need of a scalable solution to store all those megabytes. Firebase provisions a Google Cloud Storage bucket for each project, which can be used for this purpose. Or suppose you want to run some task every time a new user signs up for your app. You can use Cloud Functions with a Firebase Authentication trigger to implement this use case. The end result will be both serverless and painless.

Beyond that, Firebase provides comprehensive app monitoring, crash reporting and performance tracking capabilities as cloud services. There are also such cloud services as Cloud Messaging, App Invites and Dynamic Links which are designed to make communication and user engagement in your app ecosystem easier. Firebase Remote Config is a cloud service that enables pushing configuration changes and updates to your users in a graceful and controlled manner. Firebase even comes with some options for monetizing your apps via advertising.

Overall, Firebase strives to make offloading computational and operational burdens of mobile apps to the cloud easier. The Firebase tooling and infrastructure is aimed towards making the cloud more amenable to integration with resource-constrained and latency-sensitive mobile apps. Take Google Cloud Storage for example — an exabyte scale, geo-replicated object storage system. While it is an extremely powerful piece of cloud technology, most mobile apps won’t find it useful unless they are handling large data objects. But instead, imagine a cloud-based database solution with scalability and redundancy traits similar to that of Google Cloud Storage, but also supports structured data, powerful queries and transactional guarantees. Now imagine this solution being shipped with mobile SDKs that facilitate realtime event listeners, latency compensation and offline access on the client devices. The net result is something that is vastly beneficial to a majority of today’s mobile apps. To me this is definitely a part of the appeal and value addition that Firebase brings to the table. It terraforms the cloud to make it more useful for mobile app developers. And by the way, the imaginary cloud-based database described above is very much real, and called Cloud Firestore for Firebase.

Just like you can access GCP from Firebase, it is also possible to access Firebase from GCP. This comes in handy when you want to access Firebase services from environments like Google App Engine (PaaS), Google Compute Engine (IaaS), and Google Cloud Functions (serverless). For example, imagine writing you own web service, batch job or cloud function that needs to interact with the Firebase Realtime Database. Such use cases are made possible by Firebase Admin SDKs. Admin SDKs enable accessing Firebase services from trusted environments, and they are available in multiple server-side programming languages — Node.js, Java, Python and Go. Also they are not restricted to GCP environments either. They can run in any environment that supports the above languages, pursuant to the security requirements of your app.

Typical use cases for Admin SDKs include integrating with custom authentication systems, data migration, and automatic provisioning of user accounts. Generally speaking, Admin SDKs enable integrating pretty much any system with Firebase, thereby integrating them seamlessly with your Firebase apps. Therefore, when taken collectively, Firebase provides most of the tools necessary to implement not just individual apps, but entire managed app ecosystems complete with backend services, APIs, serverless functions, and administrative tools.

It’s been a while since I did any casual writing. My last blog entry before this one is dated June, 2015. I’ve been gradually mustering energy to switch over to Medium, and start writing again. And, for the last few months I’ve been planning to write a series of articles about Firebase, GCP and Firebase Admin SDKs. I think I’m finally there. Going forward, I intend to be fairly technical, and discuss specific use cases and code snippets whenever possible. Let me know what you think in the comments. Any suggestions for future stories are also most welcome.

Software engineer at Google. Enjoys working at the intersection of cloud, mobile and programming languages. Fan of all things tech and open source.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store