Chapter 10. Environment variable configuration
The following environment variables tune Red Hat Quay runtime behavior for geo-replication, database pooling, HTTP concurrency, and worker scaling.
Use environment variables cautiously. These options typically override or augment existing configuration mechanisms.
This section documents environment variables related to the following components:
- Geo-replication preferences
- Database connection pooling
- HTTP connection concurrency
- Worker process scaling
10.1. Geo-replication Copy linkLink copied to clipboard!
Use the QUAY_DISTRIBUTED_STORAGE_PREFERENCE environment variable to set the preferred storage engine for a geo-replicated Red Hat Quay deployment in each region.
Red Hat Quay supports multi-region deployments where multiple instances operate across geographically distributed sites. In these scenarios, each site shares the same configuration and metadata, but storage backends might vary between regions.
To accommodate this, Red Hat Quay allows specifying a preferred storage engine for each deployment using an environment variable. This ensures that while metadata remains synchronized across all regions, each region can use its own optimized storage backend without requiring separate configuration files.
| Variable | Type | Description |
|---|---|---|
| QUAY_DISTRIBUTED_STORAGE_PREFERENCE | String | The preferred storage engine (by ID in DISTRIBUTED_STORAGE_CONFIG) to use. |
10.2. Database connection pooling Copy linkLink copied to clipboard!
Use the DB_CONNECTION_POOLING environment variable and DB_CONNECTION_ARGS settings to control whether Red Hat Quay pools database connections and the maximum pool size per process.
Database connection pooling is enabled by default, and each process that interacts with the database contains a connection pool. These per-process connection pools are configured to maintain a maximum of 20 connections. Under heavy load, it is possible to fill the connection pool for every process within a Red Hat Quay container. Under certain deployments and loads, this might require analysis to ensure that Red Hat Quay does not exceed the configured database’s maximum connection count.
Overtime, the connection pools release idle connections. To release all connections immediately, Red Hat Quay requires a restart.
| Variable | Type | Description |
|---|---|---|
| DB_CONNECTION_POOLING | String |
Whether to enable or disable database connection pooling. Defaults to true. Accepted values are |
If database connection pooling is enabled, it is possible to change the maximum size of the connection pool. This can be done through the following config.yaml option:
Database connection pooling example YAML
# ...
DB_CONNECTION_ARGS:
max_connections: 10
# ...
10.2.1. Disabling database pooling in standalone deployments Copy linkLink copied to clipboard!
For standalone Red Hat Quay deployments, database connection pooling can be toggled off when starting your deployment. For example:
$ sudo podman run -d --rm -p 80:8080 -p 443:8443 \
--name=quay \
-v $QUAY/config:/conf/stack:Z \
-v $QUAY/storage:/datastorage:Z \
-e DB_CONNECTION_POOLING=false
registry.redhat.io/quay/quay-rhel8:v3.12.1
10.2.2. Disabling database pooling for Red Hat Quay on OpenShift Container Platform Copy linkLink copied to clipboard!
For Red Hat Quay on OpenShift Container Platform, database connection pooling can be configured by modifying the QuayRegistry custom resource definition (CRD). For example:
Example QuayRegistry CRD
spec:
components:
- kind: quay
managed: true
overrides:
env:
- name: DB_CONNECTION_POOLING
value: "false"
10.3. HTTP connection counts Copy linkLink copied to clipboard!
Use worker connection count environment variables to limit simultaneous HTTP connections per Red Hat Quay worker process globally or per component. These limits apply either globally or can be scoped to individual components (registry, web UI, or security scanning). By default, each worker process allows up to 50 parallel connections.
This setting is distinct from the number of worker processes.
These connection-related environment variables can be configured differently depending on your deployment type:
-
In standalone deployments, configure connection counts in the
config.yamlfile. -
In Red Hat Quay on OpenShift Container Platform deployments, define the values in the
envblock of theQuayRegistryCR.
| Variable | Type | Description |
|---|---|---|
| WORKER_CONNECTION_COUNT | Number | Global default for the maximum number of HTTP connections per worker process. Default: 50 |
| WORKER_CONNECTION_COUNT_REGISTRY | Number | HTTP connections per registry worker.
Default: |
| WORKER_CONNECTION_COUNT_WEB | Number | HTTP connections per web UI worker.
Default: |
| WORKER_CONNECTION_COUNT_SECSCAN | Number | HTTP connections per Clair security scanner worker.
Default: |
HTTP connection configuration for standalone Red Hat Quay deployments
WORKER_CONNECTION_COUNT: 10
WORKER_CONNECTION_COUNT_REGISTRY: 10
WORKER_CONNECTION_COUNT_WEB: 10
WORKER_CONNECTION_COUNT_SECSCAN: 10
HTTP connection configuration for Red Hat Quay on OpenShift Container Platform
env:
- name: WORKER_CONNECTION_COUNT
value: "10"
- name: WORKER_CONNECTION_COUNT_REGISTRY
value: "10"
- name: WORKER_CONNECTION_COUNT_WEB
value: "10"
- name: WORKER_CONNECTION_COUNT_SECSCAN
value: "10"
10.4. Worker process counts Copy linkLink copied to clipboard!
Use worker count environment variables to set how many parallel processes handle registry, web UI, and security scanning requests in Red Hat Quay.
If not explicitly set, Red Hat Quay calculates the number of worker processes automatically based on the number of available CPU cores. While this dynamic scaling can optimize performance on larger machines, it might also lead to unnecessary resource usage in smaller environments.
In Red Hat Quay on OpenShift Container Platform deployments, the Operator sets the following default values:
-
WORKER_COUNT_REGISTRY: 8 -
WORKER_COUNT_WEB: 4 -
WORKER_COUNT_SECSCAN: 2
| Variable | Type | Description |
|---|---|---|
| WORKER_COUNT | Number | Generic override for number of processes |
| WORKER_COUNT_REGISTRY | Number |
Specifies the number of processes to handle Registry requests within the |
| WORKER_COUNT_WEB | Number |
Specifies the number of processes to handle UI/Web requests within the container. Values: Integer between |
| WORKER_COUNT_SECSCAN | Number |
Specifies the number of processes to handle Security Scanning (e.g. Clair) integration within the container. Values: Integer. Because the Operator specifies 2 vCPUs for resource requests and limits, setting this value between |
Worker count configuration for standalone Red Hat Quay deployments
WORKER_COUNT: 10
WORKER_COUNT_REGISTRY: 16
WORKER_COUNT_WEB: 8
WORKER_COUNT_SECSCAN: 4
Worker count configuration for Red Hat Quay on OpenShift Container Platform
env:
- name: WORKER_COUNT
value: "10"
- name: WORKER_COUNT_REGISTRY
value: "16"
- name: WORKER_COUNT_WEB
value: "8"
- name: WORKER_COUNT_SECSCAN
value: "4"