diff options
author | Machiavelli <none@none> | 2010-12-04 21:50:36 +0100 |
---|---|---|
committer | Machiavelli <none@none> | 2010-12-04 21:50:36 +0100 |
commit | f5d6319d4ddd35a9be9ea886aa119465360e397e (patch) | |
tree | 5bd50f42122443fd93e81d40e07adbc2f589a21b /src/server/shared/Database/MySQLConnection.h | |
parent | b8bf37264b4a947e66fe29b29eb9b60ebe3d6f3c (diff) |
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.
Use at own risk, might cause instabilities.
Don´t forget to update your config files and clear your cmake cache.
--HG--
branch : trunk
Diffstat (limited to 'src/server/shared/Database/MySQLConnection.h')
-rwxr-xr-x | src/server/shared/Database/MySQLConnection.h | 7 |
1 files changed, 3 insertions, 4 deletions
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 T> class DatabaseWorker; class PreparedStatement; class MySQLPreparedStatement; class PingOperation; @@ -56,11 +56,11 @@ struct MySQLConnectionInfo class MySQLConnection { template <class T> friend class DatabaseWorkerPool; + template <class T> 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; |