Skip to content

Commit fd4e818

Browse files
authored
avoid dynamic_cast to get Pi-tag for non_internal requests (#6868)
Optimization - See lots of stack traces spending cycles on dynamic_cast for every request, when in reality, it's no longer needed as Http2ClientSession which used to inherit PluginIdentity in the past is no longer doing that and the client access protocol for access logs is being extracted directly from the HttpSM context.
1 parent e9da3e0 commit fd4e818

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

proxy/ProxyTransaction.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@ ProxyTransaction::new_transaction(bool from_early_data)
4343
HttpTxnDebug("[%" PRId64 "] Starting transaction %d using sm [%" PRId64 "]", _proxy_ssn->connection_id(),
4444
_proxy_ssn->get_transact_count(), _sm->sm_id);
4545

46-
PluginIdentity *pi = dynamic_cast<PluginIdentity *>(this->get_netvc());
47-
if (pi) {
48-
_sm->plugin_tag = pi->getPluginTag();
49-
_sm->plugin_id = pi->getPluginId();
46+
// PI tag valid only for internal requests
47+
if (this->get_netvc()->get_is_internal_request()) {
48+
PluginIdentity *pi = dynamic_cast<PluginIdentity *>(this->get_netvc());
49+
if (pi) {
50+
_sm->plugin_tag = pi->getPluginTag();
51+
_sm->plugin_id = pi->getPluginId();
52+
}
5053
}
5154

5255
this->increment_client_transactions_stat();

0 commit comments

Comments
 (0)