# Runtime Environments

## Basics

|                         | Cloud Functions                                   | App Engine                                                           | Cloud Run                                                            | Kubernetes Engine                                                        | Compute Engine                                             |
| ----------------------- | ------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | ------------------------------------------------------------------------ | ---------------------------------------------------------- |
| **Fully Managed**       | FaaS                                              | PaaS                                                                 | CaaS/PaaS                                                            | Kubernetes Clusters                                                      | Virtual Machines                                           |
| **Deployable Artifact** | Source or JAR                                     | Source or JAR                                                        | Container Image                                                      | Container Image                                                          | Anything, and Container Image                              |
| **Locality**            | Regional                                          | Regional                                                             | Regional                                                             | Zonal/Regional                                                           | Zonal/Regional                                             |
| **Billing Units**       | Instance execution time seconds and Invocations   | Instance up time minutes                                             | Instance execution time seconds                                      | Control plane and VM instance hours                                      | VM instance hours                                          |
| **vCPU**                | 1                                                 | 1, up to 4.8GHz                                                      | Up to 2                                                              | Up to 416 per node, and up to 5000 nodes.                                | 0.5 to 416                                                 |
| **Memory**              | Up to 2GB                                         | Up to 2GB                                                            | Up to 4GB                                                            | Up to 11TB per node.                                                     | Up to 11TB                                                 |
| **Disk**                | Writable `/tmp` directory                         | Writable `/tmp` directory                                            | Writable `/tmp` directory                                            | Attach Tmpfs/PD/SSD                                                      | Attach PD/SSD                                              |
| **Use For**             | <p>Webhooks</p><p>Event Handlers</p><p>Tasks </p> | <p>Web Apps</p><p>Microservices</p><p>Event Handlers</p><p>Tasks</p> | <p>Web Apps</p><p>Microservices</p><p>Event Handlers</p><p>Tasks</p> | <p>Any container workload</p><p>JEE applications</p><p>Microservices</p> | <p>Any workload</p><p>JEE applications</p><p>Databases</p> |

## Application Lifecycle

|                            | Cloud Functions   | App Engine   | Cloud Run         | Kubernetes Engine         | Compute Engine |
| -------------------------- | ----------------- | ------------ | ----------------- | ------------------------- | -------------- |
| **Liveness Check**         | Port is listening | /\_ah/health | Port is listening | Liveness Probe            | Manual         |
| **Readiness/Warmup Check** | No                | /\_ah/warmup | No                | Readiness Probe           | Manual         |
| **Graceful Shutdown**      | No Signal         | /\_ah/stop   | No Signal         | `SIGTERM` or custom hooks | Manual         |

## Scaling

|                     | Cloud Functions   | App Engine        | Cloud Run         | Kubernetes Engine                    | Compute Engine                   |
| ------------------- | ----------------- | ----------------- | ----------------- | ------------------------------------ | -------------------------------- |
| **Scaling**         | 0 to N in seconds | 0 to N in seconds | 0 to N in seconds | 1 to N in seconds or minutes         | 1 to N in minutes                |
| **Autoscaling**     | Yes               | Yes               | Yes               | Yes, with HPA and Cluster Autoscaler | Yes, with Managed Instance Group |
| **Scaling Min/Max** | No                | Yes               | Yes (alpha)       | Yes, with HPA and Cluster Autoscaler | Yes, with Managed Instance Group |
| **Manual Scaling**  | No                | Yes               | No                | Yes                                  | Yes                              |

## Load Balancing

|                             | Cloud Functions | App Engine | Cloud Run | Kubernetes Engine              | Compute Engine                  |
| --------------------------- | --------------- | ---------- | --------- | ------------------------------ | ------------------------------- |
| **Network Load Balancer**   | No              | No         | No        | Yes, with `Service`            | Yes, with Network Load Balancer |
| **HTTP**                    | Yes             | Yes        | Yes       | Yes, with `Ingress`            | Yes, with HTTP(s) Load Balancer |
| **HTTPs**                   | Yes             | Yes        | Yes       | Yes, with `Ingress`            | Yes, with HTTP(s) Load Balancer |
| **Custom Domain**           | No              | Yes        | Yes       | Yes, manual configuration      | Yes, manual configuration       |
| **Managed SSL Certificate** | Yes             | Yes        | Yes       | Yes, with `ManagedCertificate` | Yes, with HTTP(s) Load Balancer |

## Networking

|                                  | Cloud Functions | App Engine | Cloud Run | Kubernetes Engine | Compute Engine |
| -------------------------------- | --------------- | ---------- | --------- | ----------------- | -------------- |
| Use VPC                          | Yes             | Yes        | Yes       | Yes               | Yes            |
| Expose on VPC Only               | Yes             | No         | No        | Yes               | Yes            |
| Internal VPC Only Load Balancing | No              | No         | No        | Yes               | Yes            |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://spring-gcp.saturnism.me/deployment/runtime-environments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
