Skip to content

Conversation

@bneradt
Copy link
Contributor

@bneradt bneradt commented Dec 5, 2025

This introduces ParsedConfigCache in HttpConfig to automatically cache parsed results for STRING configs that require expensive parsing. When TSHttpTxnConfigStringSet() is called for configs like negative_caching_list, insert_forwarded, server_session_sharing.match, negative_revalidating_list, or host_res_data (ip_resolve), the parsing now happens once per unique value and is cached for subsequent calls. This optimization is transparent to plugins - they call TSHttpTxnConfigStringSet() as usual and automatically benefit from the caching.

Fixes: #12292

@bneradt bneradt added this to the 10.2.0 milestone Dec 5, 2025
@bneradt bneradt requested a review from masaori335 December 5, 2025 22:40
@bneradt bneradt self-assigned this Dec 5, 2025
@bneradt bneradt added Configuration conf_remap conf_remap plugin labels Dec 5, 2025
Comment on lines 7539 to 7540
auto &parsed = ParsedConfigCache::lookup(conf, std::string_view(value, length));
s->t_state.my_txn_conf().negative_caching_list = parsed.status_code_list;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These ParsedConfigCache::lookup are the high level view of where the value of this patch happens. Instead of calling the conversion logic for each of these "complex" strings (like the negative caching status list, in this example) every transaction, this parsed value retrieval is called through an interface that caches the results so that the compution is only done once.

This introduces ParsedConfigCache in HttpConfig to automatically cache
parsed results for STRING configs that require expensive parsing. When
TSHttpTxnConfigStringSet() is called for configs like
negative_caching_list, insert_forwarded, server_session_sharing.match,
negative_revalidating_list, or host_res_data (ip_resolve), the parsing
now happens once per unique value and is cached for subsequent calls.
This optimization is transparent to plugins - they call
TSHttpTxnConfigStringSet() as usual and automatically benefit from the
caching.

Fixes: apache#12292
@cmcfarlen cmcfarlen self-requested a review December 8, 2025 22:49
Copy link
Contributor

@masaori335 masaori335 left a comment

Choose a reason for hiding this comment

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

This seems better than other approaches, because we don't need to change TS APIs.

@bneradt bneradt merged commit 8bdb73e into apache:master Dec 9, 2025
15 checks passed
@bneradt bneradt deleted the config_conversion_caching branch December 9, 2025 16:00
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.

MgmtConverter is called from doRemap

2 participants