Cache the local server statistics object

By storing the server statistics object in side the session, the lookup
involved in getting a worker-local value is avoided. Since the lookup is
done multiple times for a single query, it is beneficial to store it in
the session.

As the worker-local value is never deleted, it is safe to store a
reference to it in the session. It is also never updated concurrently so
no atomic operations are necessary.
This commit is contained in:
Markus Mäkelä
2018-12-09 15:01:52 +02:00
parent 1fa3b133c7
commit 9adbd2f8f0
6 changed files with 19 additions and 14 deletions

View File

@ -169,6 +169,10 @@ public:
otrx_state m_otrx_state = OTRX_INACTIVE; /**< Optimistic trx state*/
SrvStatMap& m_server_stats; /**< The server stats local to this thread, cached in the session object.
* This avoids the lookup involved in getting the worker-local value from
* the worker's container.*/
private:
RWSplitSession(RWSplit* instance,
MXS_SESSION* session,