Skip to content

dubbo/thrift/sip: store filter chains in vectors instead of lists - #49000

Closed
wbpcode wants to merge 1 commit into
envoyproxy:mainfrom
wbpcode:dev-filter-chain-vector-dubbo-thrift-sip
Closed

wbpcode wants to merge 1 commit into
envoyproxy:mainfrom
wbpcode:dev-filter-chain-vector-dubbo-thrift-sip

Conversation

@wbpcode

@wbpcode wbpcode commented Nov 4, 2026

Copy link
Copy Markdown
Member

Commit Message: dubbo/thrift/sip: store filter chains in vectors instead of lists
Additional Description:
The dubbo, thrift and sip filter chains used std::list plus LinkedObject so that each filter wrapper could keep an iterator to resume iteration from. The chains are built once per message/RPC/transaction and are never modified afterwards, so a list is not needed.

This stores the chains in absl::InlinedVector<..., 4> and has each wrapper record its index when it is added; resuming after a filter starts from index + 1. This removes the per-filter list node allocation and, for typical chains, the container allocation entirely. Encoder filters that were pushed to the front of the list are now appended and iterated in reverse, so execution order is unchanged.

The sip conn_manager test that built its own separate filter list now adds the filters to the transaction through addDecoderFilter().

Risk Level: Low
Testing: Existing unit tests.
Docs Changes: N/A
Release Notes: N/A

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the filter-chain allocation optimization.

No open issues 🎉

What changed in this PR

This PR reduces filter-chain allocation overhead in the Dubbo, Thrift, and SIP network proxies by replacing linked lists with inline-capacity vectors while preserving filter execution order.

Changes:

  • Store filter wrappers in absl::InlinedVector<..., 4> and use recorded indices to resume iteration.
  • Iterate Thrift encoder filters in reverse to preserve their existing execution order.
  • Add build dependencies and update the SIP test to register filters through addDecoderFilter().
File Description
source/​extensions/​filters/​network/​thrift_proxy/​conn_manager.h Introduces vector-backed chains and wrapper indices.
source/​extensions/​filters/​network/​thrift_proxy/​conn_manager.cc Implements indexed traversal, reversing encoder order.
source/​extensions/​filters/​network/​thrift_proxy/​BUILD Adds the inline-vector dependency.
source/​extensions/​filters/​network/​dubbo_proxy/​BUILD Adds the inline-vector dependency.
source/​extensions/​filters/​network/​dubbo_proxy/​active_message.h Defines vector-backed chains and index-based continuation interfaces.
source/​extensions/​filters/​network/​dubbo_proxy/​active_message.cc Registers and resumes filters using vector indices.
contrib/​sip_proxy/​filters/​network/​test/​conn_manager_test.cc Uses transaction-owned filters in the continuation test.
contrib/​sip_proxy/​filters/​network/​source/​conn_manager.h Introduces vector-backed decoder chains and wrapper indices.
contrib/​sip_proxy/​filters/​network/​source/​conn_manager.cc Resumes decoder traversal by index.
contrib/​sip_proxy/​filters/​network/​source/​BUILD Adds the inline-vector dependency.

Review effort: Balanced

@wbpcode
wbpcode marked this pull request as draft November 4, 2026 14:26
@wbpcode wbpcode closed this Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants