Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ServerlessTO - with Spring Boot and GCP

Ray Tsang
January 13, 2021

ServerlessTO - with Spring Boot and GCP

Ray Tsang

January 13, 2021
Tweet

More Decks by Ray Tsang

Other Decks in Technology

Transcript

  1. 2 @saturnism @gcpcloud Ray Tsang Developer Advocate Google Cloud Platform

    Java Champion Spring Cloud GCP cloud.spring.io/spring-cloud-gcp/ @saturnism saturnism.me
  2. 8 @saturnism @gcpcloud Order UI MySQL Order Service CRUD Zipkin

    RabbitMQ Zipkin Zipkin RabbitMQ RabbitMQ Publish Event Trace Data PostgreSQL Vault Vault Vault Secrets
  3. 9 @saturnism @gcpcloud Order UI Cloud SQL Order Service CRUD

    Cloud Trace Pub/Sub Publish Event Trace Data Secret Manager Secrets
  4. 11 @saturnism @gcpcloud Service Monitoring Metrics SLO/SLA/QPS Alerting Tracing Logging

    Debugging Profiling Service / Library Source Repository Tests Build Serving Environment Ingress / HTTPs Custom Domain URL Mapping Traffic Splitting Internal / External Services Min / Max Instances Autoscaling Environment Serving Environments Databases / Resources Secret Store Artifact Repository Docker Images Maven Artifacts Vulnerability Scanning Binary Authorization … 1 1 1 * Database Secret Messaging Storage ... * 1 Infrastructure Monitoring Availability Capacity
  5. 12 @saturnism @gcpcloud Service Monitoring Metrics SLO/SLA/QPS Alerting Tracing Logging

    Debugging Profiling Service / Library Source Repository Tests Build Serving Environment Ingress / HTTPs Custom Domain URL Mapping Traffic Splitting Internal / External Services Min / Max Instances Autoscaling Environment Serving Environments Databases / Resources Secret Store Artifact Repository Docker Images Maven Artifacts Vulnerability Scanning Binary Authorization … 1 1 1 * Database Secret Messaging Storage ... * 1 Infrastructure Monitoring Availability Capacity CI CD
  6. 13 @saturnism @gcpcloud Service Monitoring Cloud Ops Metrics SLO/SLA/QPS Alerting

    Tracing Logging Debugging Profiling Service / Library GitHub Source Repository Tests Build Serving Environment Cloud Run / App Engine Ingress / HTTPs Custom Domain URL Mapping Traffic Splitting Internal / External Services Min / Max Instances Autoscaling Environment Google Cloud Project Serving Environments Databases / Resources Secret Store Artifact Repository Artifact Registry Docker Images Maven Artifacts Vulnerability Scanning Binary Authorization … 1 1 1 * Database Secret Messaging Storage ... * 1 Infrastructure Monitoring Cloud Ops Availability Capacity CI Cloud Build CD Cloud Build
  7. 14 @saturnism @gcpcloud Serverless End-to-End • Source Repository • CI/CD

    • Runtime • Databases, Secret Management, Messaging, ... • Monitoring / Operations • ... Focus on delivering value!
  8. 15 @saturnism @gcpcloud Just search for "Spring Boot GCP" https://github.com/spring-cloud/spring-cloud-gcp

    https://spring.io/projects/spring-cloud-gcp Collaboration between GCP and Spring engineers Idiomatic integrations with Spring Boot for 10+ GCP services +
  9. 16 @saturnism @gcpcloud Feature GCP Service Spring Framework Configuration Cloud

    Secret Manager Spring Cloud Config Messaging Cloud Pub/Sub Spring Integration Spring Cloud Stream Spring Dataflow Database Cloud SQL Cloud Spanner Cloud Firestore Cloud Datastore Spring Data JPA Spring Data Spanner, r2dbc driver, Hibernate Spring Data Reactive Firestore Spring Data Datastore Data Warehouse Cloud BigQuery Spring Integration Storage Cloud Storage Spring Resource Logging Stackdriver Logging Logback Trace Stackdriver Trace Spring Cloud Sleuth Metrics Stackdriver Monitoring Use Micrometer Security Cloud Identity-Aware Proxy Spring Security Vision Vision API Vision Starter
  10. 17 @saturnism @gcpcloud @SpringBootApplication class ExampleApplication { @Bean fun restTemplate()

    = RestTemplate() } fun main(args: Array<String>) { runApplication<DemoGcpApplication>(*args) } @RepositoryRestResource interface PersonRepositiory : PagingAndSortingRepository<Person, String> @Table data class Person( @PrimaryKey var id: String? = null, var name: String? = null )
  11. 19 @saturnism @gcpcloud Bring your own Fully Managed Serverless What?

    Install your own MySQL Anything you want Cloud SQL (MySQL, PostgreSQL) Cloud spanner Firestore (NoSQL) Datastore (NoSQL) Where? Compute Engine VM Kubernetes Container We host it for you We host it for you Billing? Compute resource Compute resource Usage (Reads/Writes/Storage)
  12. 20 @saturnism @gcpcloud Cloud SQL MySQL, PostgreSQL, MS SQL Multi-zone

    replication Automatic Failover Vertical Scaling Up to 416 GB of RAM and 30 TB
  13. 21 @saturnism @gcpcloud SELECT * FROM Order WHERE done =

    FALSE AND priority >= 4 ORDER BY priority DESC Each field is individually indexed Manual composite index =, >, >=, <, <= No "Like" queries
  14. 24 @saturnism @gcpcloud Spring Data CRUD operations, Pagination, Sorting out

    of the box Automatic Query generation, and custom queries No boilerplate code
  15. 27 @saturnism @gcpcloud Spring Cloud Config with Secret Manager Store

    credentials, configurations in Cloud Secret Manager Reference values in properties or SpEL No code
  16. 30 @saturnism @gcpcloud Publish/Subscribe One-to-Many Globally distributed Push & Pull

    At-least once delivery Ordering, Filtering (Beta) Pub/Sub
  17. 31 @saturnism @gcpcloud Producer Orders Topic Fulfillment Subscription Inventory Subscription

    ... Subscription Consumer Consumer Consumer Consumer Consumer Consumer Consumer Consumer Consumer msg
  18. 32 @saturnism @gcpcloud Producer Orders Topic Fulfillment Subscription Inventory Subscription

    ... Subscription Consumer Consumer Consumer Consumer Consumer Consumer Consumer Consumer Consumer msg msg msg
  19. 33 @saturnism @gcpcloud Producer Orders Topic Fulfillment Subscription Inventory Subscription

    ... Subscription Consumer Consumer Consumer Consumer Consumer Consumer Consumer Consumer Consumer msg msg msg
  20. 36 @saturnism @gcpcloud Object store No more "disk out of

    space" Multi-regional, global availability Tiered storage options Encryption at rest Cloud Storage
  21. 38 @saturnism @gcpcloud App Engine Cloud Run Deploys Your application

    A JAR! Your application A Container Image Billing Instance Hours Billable time Scaling 0 to N 0 to N CPU Available when instance is up Available when request is being processed