GraphQL 프록시 캐싱 고급 정책 구성 참조
GraphQL 프록시 캐싱 고급 정책 구성 참조 (GraphQL Proxy Caching Advanced Policy Configuration Reference)
이 문서는 Kong의 GraphQL Proxy Caching Advanced 플러그인에서 정책을 구성할 때 사용하는 파라미터들을 스키마 형태로 정리한 참조 자료예요. 캐시 저장 방식을 결정하는 memory와 redis 전략, 캐시 항목의 유효 기간을 정하는 cache_ttl 같은 기본 옵션을 먼저 확인할 수 있어요. 그리고 Redis를 백엔드로 사용할 때 필요한 호스트, Sentinel 인증, keepalive 설정 같은 세부 파라미터들의 타입과 기본값, 동작 방식까지 설명하고 있어요. 각 옵션의 의미를 이 문서와 대조하면서 원하는 캐싱 동작에 맞게 설정을 구성해 보세요.
출처: 문서
본문
{
"properties": {
"config": {
"type": "object",
"properties": {
"strategy": {
"type": "string",
"enum": [
"memory",
"redis"
],
"description": "The backing data store in which to hold cached entities. Accepted value is `memory`.",
"default": "memory"
},
"cache_ttl": {
"type": "integer",
"description": "TTL in seconds of cache entities. Must be a value greater than 0.",
"default": 300
},
"memory": {
"type": "object",
"properties": {
"dictionary_name": {
"type": "string",
"description": "The name of the shared dictionary in which to hold cache entities when the memory strategy is selected. This dictionary currently must be defined manually in the Kong Nginx template.",
"default": "kong_db_cache"
}
}
},
"redis": {
"type": "object",
"properties": {
"host": {
"type": "string",
"description": "A string representing a host name, such as example.com.",
"default": "127.0.0.1",
"x-referenceable": true
},
"sentinel_username": {
"type": "string",
"description": "Sentinel username to authenticate with a Redis Sentinel instance. If undefined, ACL authentication won't be performed. This requires Redis v6.2.0+.",
"x-referenceable": true
},
"sentinel_password": {
"type": "string",
"description": "Sentinel password to authenticate with a Redis Sentinel instance. If undefined, no AUTH commands are sent to Redis Sentinels.",
"x-referenceable": true,
"x-encrypted": true
},
"keepalive_backlog": {
"type": "integer",
"maximum": 2147483646,
"minimum": 0,
"description": "Limits the total number of opened connections for a pool. If the connection pool is full, connection queues above the limit go into the backlog queue. If the backlog queue is full, subsequent connect operations fail and return `nil`. Queued operations (subject to set timeouts) resume once the number of connections in the pool is less than `keepalive_pool_size`. If latency is high or throughput is low, try increasing this value. Empirically, this value is larger than `keepalive_pool_size`."
},
"connection_is_proxied": {
"type": "boolean",
"description": "If the connection to Redis is proxied (e.g. Envoy), set it `true`. Set the `host` and `port` to point to the proxy address.",
"default": false
},
"port": {
"type": "integer",
"maximum": 65535,
"minimum": 0,
"description": "An integer representing a port number between 0 and 65535, inclusive.",
"default": 6379,
"x-referenceable": true
},
"send_timeout": {
"type": "integer",
"maximum": 2147483646,
"minimum": 0,
"description": "An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.",
"default": 2000
},
"read_timeout": {
"type": "integer",
"maximum": 2147483646,
"minimum": 0,
"description": "An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.",
"default": 2000
},
"cluster_nodes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ip": {
"type": "string",
"description": "A string representing a host name, such as example.com.",
"default": "127.0.0.1"
},
"port": {
"type": "integer",
"maximum": 65535,
"minimum": 0,
"description": "An integer representing a port number between 0 and 65535, inclusive.",
"default": 6379
}
}
},
"minLength": 1,
"description": "Cluster addresses to use for Redis connections when the `redis` strategy is defined. Defining this field implies using a Redis Cluster. The minimum length of the array is 1 element."
},
"ssl": {
"type": "boolean",
"description": "If set to true, uses SSL to connect to Redis.",
"default": false
},
"server_name": {
"type": "string",
"description": "A string representing an SNI (server name indication) value for TLS.",
"x-referenceable": true
},
"cluster_max_redirections": {
"type": "integer",
"description": "Maximum retry attempts for redirection.",
"default": 5
},
"database": {
"type": "integer",
"description": "Database to use for the Redis connection when using the `redis` strategy",
"default": 0
},
"sentinel_master": {
"type": "string",
"description": "Sentinel master to use for Redis connections. Defining this value implies using Redis Sentinel."
},
"sentinel_role": {
"type": "string",
"enum": [
"any",
"master",
"slave"
],
"description": "Sentinel role to use for Redis connections when the `redis` strategy is defined. Defining this value implies using Redis Sentinel."
},
"sentinel_nodes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"host": {
"type": "string",
"description": "A string representing a host name, such as example.com.",
"default": "127.0.0.1"
},
"port": {
"type": "integer",
"maximum": 65535,
"minimum": 0,
"description": "An integer representing a port number between 0 and 65535, inclusive.",
"default": 6379
}
}
},
"minLength": 1,
"description": "Sentinel node addresses to use for Redis connections when the `redis` strategy is defined. Defining this field implies using a Redis Sentinel. The minimum length of the array is 1 element."
},
"ssl_verify": {
"type": "boolean",
"description": "If set to true, verifies the validity of the server SSL certificate. If setting this parameter, also configure `lua_ssl_trusted_certificate` in `kong.conf` to specify the CA (or server) certificate used by your Redis server. You may also need to configure `lua_ssl_verify_depth` accordingly.",
"default": true
},
"connect_timeout": {
"type": "integer",
"maximum": 2147483646,
"minimum": 0,
"description": "An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.",
"default": 2000
},
"username": {
"type": "string",
"description": "Username to use for Redis connections. If undefined, ACL authentication won't be performed. This requires Redis v6.0.0+. To be compatible with Redis v5.x.y, you can set it to `default`.",
"x-referenceable": true
},
"password": {
"type": "string",
"description": "Password to use for Redis connections. If undefined, no AUTH commands are sent to Redis.",
"x-referenceable": true,
"x-encrypted": true
},
"cloud_authentication": {
"type": "object",
"properties": {
"aws_region": {
"type": "string",
"description": "The region of the AWS ElastiCache cluster when `auth_provider` is set to `aws`.",
"x-referenceable": true
},
"aws_access_key_id": {
"type": "string",
"description": "AWS Access Key ID to be used for authentication when `auth_provider` is set to `aws`.",
"x-referenceable": true,
"x-encrypted": true
},
"aws_secret_access_key": {
"type": "string",
"description": "AWS Secret Access Key to be used for authentication when `auth_provider` is set to `aws`.",
"x-referenceable": true,
"x-encrypted": true
},
"gcp_service_account_json": {
"type": "string",
"description": "GCP Service Account JSON to be used for authentication when `auth_provider` is set to `gcp`.",
"x-referenceable": true,
"x-encrypted": true
},
"azure_client_id": {
"type": "string",
"description": "Azure Client ID to be used for authentication when `auth_provider` is set to `azure`.",
"x-referenceable": true,
"x-encrypted": true
},
"azure_client_secret": {
"type": "string",
"description": "Azure Client Secret to be used for authentication when `auth_provider` is set to `azure`.",
"x-referenceable": true,
"x-encrypted": true
},
"azure_tenant_id": {
"type": "string",
"description": "Azure Tenant ID to be used for authentication when `auth_provider` is set to `azure`.",
"x-encrypted": true,
"x-referenceable": true
},
"auth_provider": {
"type": "string",
"enum": [
"aws",
"azure",
"gcp"
],
"description": "Auth providers to be used to authenticate to a Cloud Provider's Redis instance.",
"x-referenceable": true
},
"aws_is_serverless": {
"type": "boolean",
"description": "This flag specifies whether the cluster is serverless when auth_provider is set to `aws`.",
"default": true
},
"aws_assume_role_arn": {
"type": "string",
"description": "The ARN of the IAM role to assume for generating ElastiCache IAM authentication tokens.",
"x-encrypted": true,
"x-referenceable": true
},
"aws_role_session_name": {
"type": "string",
"description": "The session name for the temporary credentials when assuming the IAM role.",
"x-referenceable": true,
"x-encrypted": true
},
"aws_cache_name": {
"type": "string",
"description": "The name of the AWS Elasticache cluster when `auth_provider` is set to `aws`.",
"x-referenceable": true
}
},
"description": "Cloud auth related configs for connecting to a Cloud Provider's Redis instance."
},
"keepalive_pool_size": {
"type": "integer",
"maximum": 2147483646,
"minimum": 1,
"description": "The size limit for every cosocket connection pool associated with every remote server, per worker process. If neither `keepalive_pool_size` nor `keepalive_backlog` is specified, no pool is created. If `keepalive_pool_size` isn't specified but `keepalive_backlog` is specified, then the pool uses the default value. Try to increase (e.g. 512) this value if latency is high or throughput is low.",
"default": 256
}
}
},
"bypass_on_err": {
"type": "boolean",
"description": "Unhandled errors while trying to retrieve a cache entry (such as redis down) are resolved with `Bypass`, with the request going upstream.",
"default": false
},
"vary_headers": {
"type": "array",
"items": {
"type": "string"
},
"description": "Relevant headers considered for the cache key. If undefined, none of the headers are taken into consideration."
}
}
}
}
}
더 알아보기 (Learn more)
이 문서에는 원문에서 추출한 별도의 관련 문서 링크가 없어요.