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

Provisioning Cell-based Architectures with Terr...

Provisioning Cell-based Architectures with Terraform

Yury Nino

March 01, 2025
Tweet

More Decks by Yury Nino

Other Decks in Technology

Transcript

  1. ©2024 HASHICORP 4 Agenda Cell-based Architectures in Detail Challenging Cloud

    Disasters Provisioning Cell-based with Terraform Operational Considerations Takeaways
  2. © HASHICORP 5 Challenges to face in the Cloud Reliability:

    Availability - Scalability - Security - Resilience 01
  3. ©2024 HASHICORP The Bulkhead Pattern is a type of application

    design that is tolerant of failure. In a bulkhead architecture, elements of an application are isolated into pools so that if one fails, the others will continue to function. If the hull of a ship is compromised, only the damaged section fills with water, which prevents the ship from sinking. https://learn.microsoft.com/en-us/azure/architecture/patterns/bulkhead†
  4. ©2024 HASHICORP A cell-based architecture uses multiple isolated instances of

    a workload, where each instance is known as a cell. Each cell is independent, does not share state with other cells, and handles a subset of the overall workload requests. This reduces the potential impact of a failure, such as a bad software update, to an individual cell and the requests that it's processing.
  5. ©2024 HASHICORP Cell-based Architectures Key Components • Cell . •

    Cell Router . • Cell Communication Layer . • Control Plane . • Extra: Data Plane, Mgmt Plane
  6. ©2024 HASHICORP Cell-based Architectures The Promise • Increase the resilience

    of systems. . • Are a good option to face downtime. . • Augment the scalability of microservices. . • Make clearer complex architectures. . • Improve the security of distributed systems. . Erica Pisani
  7. ©2024 HASHICORP Cell-based Architectures The Promise • Increase the resilience

    of systems by reducing the blast radius of failures. • Are a good option to face downtime by forcing fixed-size cells as deployment units. • Augment the scalability of microservices by favoring a scale-out rather than a scale-up. • Make clearer complex architectures by packaging and deploying as a cell services. • Improve the security of distributed systems by applying an additional level of security around cells.
  8. © HASHICORP 16 Each cell operates independently with its resources.

    Design Determining each cell's optimal capacity to ensure it can handle. Size Distributing and managing application workload self-contained cells. Deploy On dividing a system's workload among distinct cells to optimize. Partition Ensuring efficient workload management and scalability Implement Cell-based Architectures The Process
  9. © HASHICORP 18 Each cell operates independently with its resources.

    Design Determining each cell's optimal capacity to ensure it can handle. Size Distributing and managing application workload self-contained cells. Deploy On dividing a system's workload among distinct cells to optimize. Partition Ensuring efficient workload management and scalability Implement Cell-based Architectures The Process
  10. ©2024 HASHICORP 1. Design a Cell • Identify functionalities that

    can be isolated into individual cells. • Consider grouping services by their operational needs. • Equip each cell with the necessary resources. • Implement effective communication between cells.
  11. ©2024 HASHICORP CODE EDITOR # Configure Google Cloud Provider #

    Provision a Cloud Run Function resource "google_cloudfunctions2_function" "default" { project = var.project_id name = "function-cell" location = "us-central1" description = "a new cell" build_config { runtime = "nodejs16" entry_point = "helloHttp" # Set the entry point source { storage_source { bucket = google_storage_bucket.default.name object = google_storage_bucket_object.object.name } } } • Google Cloud account. • Cloud Run Functions. • Databases, Buckets. • Terraform. 1. Design a Cell
  12. © HASHICORP 21 Each cell operates independently with its resources.

    Design Determining each cell's optimal capacity to ensure it can handle. Size Distributing and managing application workload self-contained cells. Deploy On dividing a system's workload among distinct cells to optimize. Partition Ensuring efficient workload management and scalability Implement Cell-based Architectures The Process
  13. ©2024 HASHICORP 2. Partition a Cell • Identify partition criteria:

    location, user ID, request type, or date range. • Implement routing logic or use an API gateway with criteria to redirect. • Use this data to adjust partitioning criteria and routing logic. • Partitioning algorithms: hashing, sharding, round-robin, dynamic.
  14. ©2024 HASHICORP # Configure an API gateway resource "google_api_gateway_api" "api_cfg"

    { provider = google-beta api_id = "gateway-router" } resource "google_api_gateway_api_config" "api_cfg" { provider = google-beta api = google_api_gateway_api.api_cfg.api_id api_config_id = "my-config" openapi_documents { document { path = "spec.yaml" contents = filebase64( "openapi.yaml") } } lifecycle { create_before_destroy = true } } CODE EDITOR • Google Cloud account. • Cloud API gateway. • openapi.yaml • Terraform. 2. Partition a Cell
  15. ©2024 HASHICORP # Configure openapi.yaml swagger: '2.0' info: title: "gateway-router"

    description: cell router on API Gateway version: 1.0.0 schemes: - https produces: - application/json paths: /cell/1: get: summary: Greet a user operationId: hello x-google-backend: address: https://cloudfunctions.net/cell/1 responses: '200': description: A successful response schema: type: string CODE EDITOR • Google Cloud account. • Cloud API gateway. • openapi.yaml • Terraform. 2. Partition a Cell
  16. © HASHICORP 25 Each cell operates independently with its resources.

    Design Determining each cell's optimal capacity to ensure it can handle. Size Distributing and managing application workload self-contained cells. Deploy On dividing a system's workload among distinct cells to optimize. Partition Ensuring efficient workload management and scalability Implement Cell-based Architectures The Process
  17. ©2024 HASHICORP 3. Size the Cell • Workload Analysis •

    Resource Requirements • Performance Metrics • Scalability Goals • Testing and Adjustment
  18. ©2024 HASHICORP CODE EDITOR # Configure Google Cloud Provider #

    Provision a Cloud Run Function resource "google_cloudfunctions_function" "function" { name = "function-test" description = "My function" runtime = "nodejs16" available_memory_mb = 128 source_archive_bucket = google_storage_bucket.bu… source_archive_object = google_storage_bucket_object.archive.name trigger_http = true entry_point = "helloGET" } • Google Cloud account. • Cloud Run Functions. • Databases, Buckets. • Terraform. 3. Size the Cell
  19. © HASHICORP 28 Each cell operates independently with its resources.

    Design Determining each cell's optimal capacity to ensure it can handle. Size Distributing and managing application workload self-contained cells. Deploy On dividing a system's workload among distinct cells to optimize. Partition Ensuring efficient workload management and scalability Implement Cell-based Architectures The Process
  20. ©2024 HASHICORP 5. Deploy the Architecture • Automated Deployment Pipelines

    • Blue/Green Deployments • Canary Releases. https://developer.hashicorp.com/terraform/tutorials/aws/blue-green-canary-tests-deployments
  21. © HASHICORP 33 Each cell operates independently with its resources.

    Design Determining each cell's optimal capacity to ensure it can handle. Size Focus on three key areas: logging, monitoring, and tracing. Observability On dividing a system's workload among distinct cells to optimize. Partition Ensuring efficient workload management and scalability Implement and Deploy Cell-based Architectures The Process
  22. ©2024 HASHICORP 6. Observe the Architecture • Logging Tools. •

    Monitoring Solutions. • Distributed Tracing Systems, • Services Meshes
  23. ©2024 HASHICORP Cell-based Architectures Takeaways • The core concept of

    cell based architectures is breaking down a system into self-contained units (cells), each with its own resources and functionality. • Essential elements include the cells themselves, a "cell router" to direct traffic, an inter-cell communication layer, and a control plane for overall management. • Cell-based architectures offer advantages like improved scalability, resilience, and safer deployments, but introduces complexities in design, implementation, data consistency, and operational overhead. .