Skip to content

Conversation

masaori335
Copy link
Contributor

@masaori335 masaori335 commented Jun 12, 2025

Address #12292. Using MgmtConverter for list and other containers has a overhead because the per-remap configurations are stored as a string and parsed on every transactions. This PR avoids that cost by parsing the string once at config-load time by introducing new TS APIs.

New TS APIs Proposal

TS_RECORDDATATYPE_VARIANT
using TSConfigValue = std::variant<HttpStatusCodeList *>;

TSReturnCode TSHttpTxnConfigParse(TSConfigValue &dst, TSOverridableConfigKey key, const char *value, size_t length);
TSReturnCode TSHttpTxnConfigSet(TSHttpTxn txnp, TSOverridableConfigKey key, const TSConfigValue &src);

TSHttpTxnConfigParse parses given string into appropriate data structure and stores it in a TSConfigValue. It's a variant of data structures. TSHttpTxnConfigSet set the parsed TSConfigValue to the transaction to override a variable.

TSConfigValue is a std::variant for type safety and future extension.

Usage

The changes in conf_remap illustrate how to use the new APIs.

  1. (Re)loading config: Parse the config string into HttpStatusCodeList * by TSHttpTxnConfigParse and store it in the TSConfigValue
  2. Remap: Override the variable by TSHttpTxnConfigSet

@masaori335 masaori335 added this to the 10.2.0 milestone Jun 12, 2025
@masaori335 masaori335 self-assigned this Jun 12, 2025
@masaori335 masaori335 marked this pull request as draft June 13, 2025 07:27
@masaori335
Copy link
Contributor Author

After talked with @zwoop, this is trying to combine current type specific set APIs into one TSHttpTxnConfigSet.

HttpStatusCodeList *,
HostResData *,
HttpForwardedConf *,
TSOutboundConnectionMatchType>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now, this variant captures all types in the OverridableHttpConfigParams. However, as @zwoop pointed out, every time we add a new type here, ABI compatibility is broken 🤔

@masaori335
Copy link
Contributor Author

This is getting big change, so let me divide into 2 steps.

1). Make negative_caching_list/negative_revalidating_list overridable with MgmtConverter
2). Fix overhead of MgmtConverter by introducing new TS APIs.

@masaori335 masaori335 closed this Jun 20, 2025
@masaori335 masaori335 reopened this Jun 22, 2025
@masaori335 masaori335 changed the title Make negative_caching_list/negative_revalidating_list overridable New TS APIs - TSHttpTxnConfigParse/TSHttpTxnConfigSet Jun 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant