From f5d6319d4ddd35a9be9ea886aa119465360e397e Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Sat, 4 Dec 2010 21:50:36 +0100 Subject: Core/DBLayer: - Make the mysql connectionpool shared for async and syncrhonous connections. - Allow configurable amount of connections for the pool - Allow configurable amount of delaythreads Note that delaythreads now only represent in-core threads. Whenever they execute a task they will pick a free connection from the pool instead of using their previously unique assigned connection. The purpose of this design change is better distribution of SQL requests (no bottlenecks paired with idling) among available resources. This also prevents a ¨memory waste¨ of preparing async prepared statements on synchronous connections (that were never called) - and vice versa. Now, connections aren´t explicitly async or synchronous, they serve both purposes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use at own risk, might cause instabilities. Don´t forget to update your config files and clear your cmake cache. --HG-- branch : trunk --- src/server/shared/Database/MySQLConnection.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/server/shared/Database/MySQLConnection.h') diff --git a/src/server/shared/Database/MySQLConnection.h b/src/server/shared/Database/MySQLConnection.h index 56a670d07c1..a72b5b2b54b 100755 --- a/src/server/shared/Database/MySQLConnection.h +++ b/src/server/shared/Database/MySQLConnection.h @@ -22,7 +22,7 @@ #ifndef _MYSQLCONNECTION_H #define _MYSQLCONNECTION_H -class DatabaseWorker; +template class DatabaseWorker; class PreparedStatement; class MySQLPreparedStatement; class PingOperation; @@ -56,11 +56,11 @@ struct MySQLConnectionInfo class MySQLConnection { template friend class DatabaseWorkerPool; + template friend class DatabaseWorker; friend class PingOperation; public: - MySQLConnection(MySQLConnectionInfo& connInfo); //! Constructor for synchroneous connections. - MySQLConnection(ACE_Activation_Queue* queue, MySQLConnectionInfo& connInfo); //! Constructor for asynchroneous connections. + MySQLConnection(MySQLConnectionInfo& connInfo); ~MySQLConnection(); virtual bool Open(); @@ -102,7 +102,6 @@ class MySQLConnection private: ACE_Activation_Queue* m_queue; //! Queue shared with other asynchroneous connections. - DatabaseWorker* m_worker; //! Core worker task. MYSQL * m_Mysql; //! MySQL Handle. MySQLConnectionInfo& m_connectionInfo; //! Connection info (used for logging) ACE_Thread_Mutex m_Mutex; -- cgit v1.2.3