Skip to content

Commit

Permalink
[3scale_batcher] Introduce APICAST_POLICY_BATCHER_SHARED_MEMORY_SIZE
Browse files Browse the repository at this point in the history
In some cases, the batcher policy will run out of storage space (batched_reports)
and cause metrics to not being reported. This commit adds a new environment
variable to configure the batcher policy shared memory storage size
  • Loading branch information
tkan145 committed Mar 14, 2024
1 parent 8ef1568 commit 90e18eb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Added `APICAST_CLIENT_REQUEST_HEADER_BUFFERS` variable to allow configure of the NGINX `client_request_header_buffers` directive: [PR #1446](https://github.com/3scale/APIcast/pull/1446), [THREESCALE-10164](https://issues.redhat.com/browse/THREESCALE-10164)

Added `APICAST_POLICY_BATCHER_SHARED_MEMORY_SIZE` variable to allow configure batcher policy share memory size. [PR #1452](https://github.com/3scale/APIcast/pull/1452), [THREESCALE-9537](https://issues.redhat.com/browse/THREESCALE-9537)

## [3.14.0] 2023-07-25

### Fixed
Expand Down
7 changes: 7 additions & 0 deletions doc/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,13 @@ Sets the maximum number and size of buffers used for reading large client reques
The format for this value is defined by the [`large_client_header_buffers` NGINX
directive](https://nginx.org/en/docs/http/ngx_http_core_module.html#large_client_header_buffers)

### `APICAST_POLICY_BATCHER_SHARED_MEMORY_SIZE`

**Default:** 20m
**Value:** string

Sets the maximum size of shared memory used by batcher policy.

### `OPENTELEMETRY`

This environment variable enables NGINX instrumentation using OpenTelemetry tracing library.
Expand Down
12 changes: 12 additions & 0 deletions gateway/conf.d/backend.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,15 @@ location /transactions/oauth_authrep.xml {

echo "transactions oauth_authrep!";
}

location /transactions/authorize.xml {
access_by_lua_block {
local delay = tonumber(ngx.var.arg_delay) or 0

if delay > 0 then
ngx.sleep(delay)
end
}

echo "transactions oauth_authrep!";
}
2 changes: 1 addition & 1 deletion gateway/http.d/shdict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ lua_shared_dict limiter 1m;
# This is not ideal, but they'll need to be here until we allow policies to
# modify this template.
lua_shared_dict cached_auths 20m;
lua_shared_dict batched_reports 20m;
lua_shared_dict batched_reports {{env.APICAST_POLICY_BATCHER_SHARED_MEMORY_SIZE | default: "20m"}};
lua_shared_dict batched_reports_locks 1m;

0 comments on commit 90e18eb

Please sign in to comment.