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:
@ -15,7 +15,7 @@
|
||||
#include <maxscale/ccdefs.hh>
|
||||
|
||||
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <maxscale/server.h>
|
||||
#include <maxbase/average.hh>
|
||||
@ -59,5 +59,5 @@ private:
|
||||
maxbase::CumulativeAverage m_num_ave_session_selects;
|
||||
};
|
||||
|
||||
using SrvStatMap = std::map<SERVER*, ServerStats>;
|
||||
using SrvStatMap = std::unordered_map<SERVER*, ServerStats>;
|
||||
}
|
||||
|
Reference in New Issue
Block a user