Set up Serverless Store: Further Discussion

Ratros Y.
Ratros Y.
Jan 24 · 2 min read

Between Serverless and VMs

As explained in the opening piece, serverless computing is not necessarily a replacement for VM-based solutions. Some individuals and organizations may favor VMs over serverless solutions for their portability, manageability, and security. Last year in Next 18’, Google announced an open-source project, Knative, which allows developers and operators to build a custom serverless platform on Kubernetes. Since Kubernetes solutions are VM-based, the Knative project can be loosely seen as a middle ground between serverless and VMs; if properly configured, it may offer the best of two worlds. You can learn more about Knative here.

Cloud Pub/Sub

Cloud Pub/Sub guarantees at-least-once delivery. In other words, it is possible that some messages may get delivered more than once. When using Cloud Pub/Sub for event delivery, developers should

  • Use idempotent event subscribers whenever possible; if not assign a unique identifier for each event and use a persistent storage/cache for reference
  • Discard stale events (for example, events created two days ago)

Additionally, Cloud Pub/Sub does not guarantee the ordering of messages. For more information, see Ordering messages.


Caching is still critical for serverless apps running on managed services, especially in production, even though serverless systems scale themselves automatically and may not require caches for performance improvement. Most managed products and services, such as Cloud Firestore and Google BigQuery, charges for API calls and requests, and have project-specific quotas and limitations; if necessary, implement a caching layer in your project to keep the number of requests sent in control.

Event-driven computing

Cloud-native event-driven computing is still fairly new and the pattern showcased in the Serverless Store is far from perfect. For example, you may have realized that the specifications of events is still hard-coded in the app, rather than loaded from a central registry or a specification file, as in the case of OpenAPI and gRPC service development. Google is actively contributing to the CloudEvents project and adding event support to more Google Cloud Platform products and services at this moment; you may want to check these experimental projects out when you build your own serverless event-driven app.


The demo app keeps credentials in environment variables for simplicity reasons, which is a highly discouraged practice for production apps. Google Cloud Platform provides Cloud KMS (Cloud Key Management Service) for managing encryption keys in the Cloud; you may want to integrate it in your serverless app for better security and easier management.

Ratros Y.

Written by

Ratros Y.

Developer Relations @ Google Cloud Platform

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade