Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Building a Production Grade PostgreSQL Cloud Foundry Service | anynines

1,508 views

Published on

Slides to the talk held at the Cloud Foundry Summit in Santa Clara 2016 about building a on-demand provisioning PostgreSQL Cloud Foundry Services being able to deploy dedicated PostgreSQL servers and 3-node-async-replicating clusters using Bosh.

The slides cover important design decisions such as single PostgreSQL server vs. PostgreSQL clusters, shared vs. dedicated PostgreSQL servers, pre-provisioning vs. on-demand provisioning of vms, the right choice of the automation technology as well as a draft of a resulting architecture.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Building a Production Grade PostgreSQL Cloud Foundry Service | anynines

  1. 1. Building a produc.on grade PostgreSQL Cloud Foundry Service
  2. 2. Produc.on grade?
  3. 3. Produc.on Ready Litmus Test: Run a public CF.
  4. 4. Design Decisions
  5. 5. Defining service instances.
  6. 6. PostgreSQL 
 Server vs. Cluster
  7. 7. Replica.on
  8. 8. Sync vs. Async
  9. 9. Async replica.on is built-in since PostgreSQL 9
  10. 10. PostgreSQL 
 Replica.on Limita.ons
  11. 11. Failure Detec.on Automa.c Failover
  12. 12. repmgr Replica.on Manager for PostgreSQL clusters
  13. 13. • Monitoring replica.on performance • Failure detec.on • Automated failover • Leader elec.on • Master promo.on
  14. 14. Shared vs Dedicated
 PostgreSQL VMs
  15. 15. Shared
  16. 16. • Single VM or single cluster of VMs • Single PostgreSQL server or single PostgreSQL cluster • Isola8on limited to PostreSQL mul8- tenancy capabili8es Shared PostgreSQL Cluster > Bad idea 3 VMs Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 1 VM Postgresql VM#1 PostgreSQL Cluster Single PostgreSQL Server Service Instance Service Instance 2 Service Instance 3 Service Instance 1 Service Instance 2 Service Instance 3 Service Instance 1 Service Instance 2 Service Instance 3 Service Instance 1 Service Instance 2 Service Instance 3 Service Instance 1 OR 1x 1x
  17. 17. Shared PostgreSQL = SPOF
  18. 18. Cloud Foundry Run.me 3 VMs PostgreSQL Cluster Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 Service Instance Service Instance Service Instance Service Instance Service Instance Service Instance Service Instance Service Instance Service Instance App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App
  19. 19. Cloud Foundry Run.me 3 VMs PostgreSQL Cluster Service Instance Service Instance Service Instance Service Instance Service Instance Service Instance App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App Service Instance Service Instance Service Instance
  20. 20. Cloud Foundry Run.me 3 VMs PostgreSQL Cluster Service Instance Service Instance Service Instance Service Instance Service Instance Service Instance App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App Service Instance Service Instance Service Instance
  21. 21. Cloud Foundry Run.me 3 VMs PostgreSQL Cluster Service Instance Service Instance Service Instance Service Instance Service Instance Service Instance App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App Service Instance Service Instance Service Instance
  22. 22. Your shared PostgreSQL cluster goes down, all your PostgreSQL database instances go down.
  23. 23. Dedicated
  24. 24. • Service instance = dedicated VM or dedicated cluster of VMs • Uses infrastructure isola8on to enable mul8-tenancy support Dedicated PostgreSQL instances > Good idea my-3node-postgres-cluster-2 Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 my-single-postgres-1 Postgresql VM#1 Service Instance Service Instance n x m x and / or
  25. 25. Cloud Foundry Run.me App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 Service Instance Postgresql VM Service Instance Postgresql VM Service Instance Postgresql VM Service Instance Postgresql VM Service Instance Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 Service Instance Postgresql VM Service Instance Postgresql VM Service Instance
  26. 26. Cloud Foundry Run.me App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 Service Instance Postgresql VM Service Instance Postgresql VM Service Instance Postgresql VM Service Instance Postgresql VM Service Instance Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 Service Instance Postgresql VM Service Instance Postgresql VM Service Instance
  27. 27. Cloud Foundry Run.me App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App App Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 Service Instance Postgresql VM Service Instance Postgresql VM Service Instance Postgresql VM Service Instance Postgresql VM Service Instance Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 Service Instance Postgresql VM Service Instance Postgresql VM Service Instance
  28. 28. PostgreSQL failures are contained. Only one service instance affected.
  29. 29. Pre- vs. On-Demand Provisioning
  30. 30. Pre-Provisioned
  31. 31. Pre-provisoned service instances my-3node-postgres-cluster-2 Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 my-single-postgres-1 Postgresql VM#1 Service InstanceService Instance Service Broker
  32. 32. $> cf create-service postgresql single-small my-single-postgres-1 Easy Deployment
  33. 33. Pre-provisioned service instances my-3node-postgres-cluster-2 Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 my-single-postgres-1 Postgresql VM#1 Service InstanceService Instance Service Broker
  34. 34. $> cf create-service postgresql cluster-small my-3node-postgres- cluster-2 Easy Deployment
  35. 35. Pre-provisioned service instances my-3node-postgres-cluster-2 Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 my-single-postgres-1 Postgresql VM#1 Service InstanceService Instance Service Broker
  36. 36. On-Demand-Provisioned
  37. 37. On-demand provisioned service instances Service Broker Some Automa.on
  38. 38. On-demand provisioned service instances my-single-postgres-1 Postgresql VM#1 Service Instance Service Broker Some Automa.on
  39. 39. Pre-provisoned service instances my-3node-postgres-cluster-2 Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 my-single-postgres-1 Postgresql VM#1 Service InstanceService Instance Service Broker Some Automa.on
  40. 40. Automa.on Technology
  41. 41. Bosh = ❤
  42. 42. Infrastructure independence
  43. 43. VM and persistent disk management
  44. 44. OS independence
  45. 45. Blueprint vs. construc.on Bosh Release vs. Bosh deployment
  46. 46. One Bosh release, 
 several service plans. PostgreSQL single vm vs. PostgreSQL cluster
  47. 47. Monitoring & Self-Healing
  48. 48. my-3node-postgres-cluster-1 Postgresql VM#1 Postgresql VM#2 Postgresql VM#3
  49. 49. my-3node-postgres-cluster-1 Postgresql VM#1 Postgresql VM#2 Postgresql VM#3
  50. 50. my-3node-postgres-cluster-1 Postgresql VM#1 Postgresql VM#3
  51. 51. my-3node-postgres-cluster-1 Postgresql VM#1 Postgresql VM#2 Postgresql VM#3
  52. 52. Scalability
  53. 53. my-single-postgres-1 Postgresql VM#1 my-3node-postgres-cluster-1 Postgresql VM#1 Postgresql VM#2 Postgresql VM#3
  54. 54. $> cf service-update my-single- postgres-1 -p cluster-large Scalability
  55. 55. my-3node-postgres-cluster-1 Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 my-single-postgres-1 Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 Single node postgresql service instance > turned into a 3-node postgresql cluster.
  56. 56. $> cf service-update 
 my-3node-postgres-cluster-1 
 -p cluster-large Scalability
  57. 57. my-3node-postgres-cluster-1 Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 my-single-postgres-1 Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 Small cluster turned into a large cluster.
  58. 58. Architectural Overview
  59. 59. a9s Deployer Templates Deployments Bosh a9s Service Broker my-3node-postgres-cluster-2 Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 my-single-postgres-1 Postgresql VM#1 Middleware Adapter Cloud Foundry Adapter a9s PostgreSQL SPI Service InstanceService Instance my-3node-postgres-cluster-3 Postgresql VM#1 Postgresql VM#2 Postgresql VM#3 Service Instance … Cloud ControllerCF Client create service create service create deployment from template xy with a_ributes {…} deploy release abc & deployment manifest xyz Execute deployments create service specific 
 creden.als create binding
  60. 60. a9s Service Broker
  61. 61. • Implements the CF Service Broker API • Generic • Data service specific SPIs a9s Service Broker
  62. 62. a9s PostgreSQL SPI
  63. 63. The PostgreSQL SPI encapsulates PostgreSQL specific logic
  64. 64. • Service catalog metadata, e.g. service plans • PostgreSQL instance creden8al management (service bindings) a9s PostgreSQL SPI
  65. 65. a9s Deployer
  66. 66. The a9s Deployer manages Bosh deployments
  67. 67. Component Interac.on
  68. 68. Lessons Learned
  69. 69. • Dedicated service instances are mandatory • On-demand provisioning is essen.al • Bosh does a great job
  70. 70. The greatest challenge with PostgreSQL was
  71. 71. • Finding a PostgreSQL replica.on & clustering toolset that allows automa.on • Itera.vely learn how to configure and automate common and edge-case scenarios.
  72. 72. Ques.ons? @fischerjulian @anynines
  73. 73. Thank you. @fischerjulian @anynines

×