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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MgmtConverter is called from doRemap

1 participant