You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "houtengfei193-spec (via GitHub)" <gi...@apache.org> on 2026/04/23 09:39:21 UTC
[PR] feat: support custom_lua_shared_dict in global lua {} block and stream {} block [apisix]
houtengfei193-spec opened a new pull request, #13286:
URL: https://github.com/apache/apisix/pull/13286
## What this PR does
Currently, `custom_lua_shared_dict` only works in the `http {}` block (added in #5030). This PR extends the same mechanism to:
1. **The global `lua {}` block** (requires `apisix-nginx-module`) — for shared dicts accessible by both HTTP and Stream subsystems
2. **The `stream {}` block** — for stream-only shared dicts
## Why
Users who need cross-subsystem shared dicts (e.g., for lifecycle management, custom metrics, global state sharing) currently have to manually patch `ngx_tpl.lua`. This PR allows them to simply configure it in `config.yaml`:
```yaml
nginx_config:
meta:
custom_lua_shared_dict:
my-global-dict: 1m # shared between http and stream
stream:
custom_lua_shared_dict:
my-stream-dict: 5m # stream only
```
## Changes
| File | Change |
|------|--------|
| `apisix/cli/ngx_tpl.lua` | Add dynamic rendering loop in `lua {}` and `stream {}` blocks |
| `apisix/cli/config.lua` | Add default empty `custom_lua_shared_dict` for `meta` and `stream` |
| `apisix/cli/schema.lua` | Add schema validation for `meta` and `stream` custom_lua_shared_dict |
| `t/cli/test_custom_shared_dict.sh` | Test cases covering meta, stream, combined, and empty configs |
## Backward Compatibility
100% backward compatible. Default `custom_lua_shared_dict` is an empty table — no behavior change without explicit configuration.
**Note:** The `meta.custom_lua_shared_dict` feature only takes effect when `apisix-nginx-module` is compiled in (i.e., `use_apisix_base` is true), since the global `lua {}` block itself is only rendered in that case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support custom_lua_shared_dict in global lua {} block and stream {} block [apisix]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13286:
URL: https://github.com/apache/apisix/pull/13286#issuecomment-4832096626
This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 4 weeks if no further activity occurs. If you think that's incorrect or this pull request should instead be reviewed, please simply write any comment. Even if closed, you can still revive the PR at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support custom_lua_shared_dict in global lua {} block and stream {} block [apisix]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13286:
URL: https://github.com/apache/apisix/pull/13286#issuecomment-5103487791
This pull request/issue has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support custom_lua_shared_dict in global lua {} block and stream {} block [apisix]
Posted by "houtengfei193-spec (via GitHub)" <gi...@apache.org>.
houtengfei193-spec commented on PR #13286:
URL: https://github.com/apache/apisix/pull/13286#issuecomment-4324667736
Hi @nic-6443 @shreemaan-abhishek, could you help approve the CI workflow for this PR? It's a small change (size:M) extending `custom_lua_shared_dict` to support `stream {}` and global `lua {}` blocks. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support custom_lua_shared_dict in global lua {} block and stream {} block [apisix]
Posted by "houtengfei193-spec (via GitHub)" <gi...@apache.org>.
houtengfei193-spec commented on PR #13286:
URL: https://github.com/apache/apisix/pull/13286#issuecomment-4349350776
@membphis @tzssangglass @spacewander
Could you please review this PR? All CI checks have passed.
This PR adds support for `custom_lua_shared_dict` in:
- Global `lua {}` block (for sharing between HTTP and Stream subsystems)
- `stream {}` block (for Stream-only dictionaries)
This resolves the need to manually modify `ngx_tpl.lua` when users need cross-subsystem shared dictionaries (e.g., for lifecycle management, custom metrics, global state sharing).
All 18 CI checks have passed (1 skipped for DockerHub build which is expected for PRs).
Thank you for your time and review!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support custom_lua_shared_dict in global lua {} block and stream {} block [apisix]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #13286: feat: support custom_lua_shared_dict in global lua {} block and stream {} block
URL: https://github.com/apache/apisix/pull/13286
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org