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
This commit is contained in:
Machiavelli
2010-12-04 21:50:36 +01:00
parent b8bf37264b
commit f5d6319d4d
10 changed files with 129 additions and 176 deletions

View File

@@ -419,7 +419,7 @@ bool Master::_StartDB()
{
sLog.SetLogDB(false);
std::string dbstring;
uint8 async_threads, synch_threads;
uint8 async_threads, connections;
dbstring = sConfig.GetStringDefault("WorldDatabaseInfo", "");
if (dbstring.empty())
@@ -436,10 +436,10 @@ bool Master::_StartDB()
return false;
}
synch_threads = sConfig.GetIntDefault("WorldDatabase.SynchThreads", 1);
connections = sConfig.GetIntDefault("WorldDatabase.Connections", 2);
///- Initialise the world database
if (!WorldDatabase.Open(dbstring, async_threads, synch_threads))
if (!WorldDatabase.Open(dbstring, async_threads, connections))
{
sLog.outError("Cannot connect to world database %s", dbstring.c_str());
return false;
@@ -460,10 +460,10 @@ bool Master::_StartDB()
return false;
}
synch_threads = sConfig.GetIntDefault("CharacterDatabase.SynchThreads", 2);
connections = sConfig.GetIntDefault("CharacterDatabase.Connections", 2);
///- Initialise the Character database
if (!CharacterDatabase.Open(dbstring, async_threads, synch_threads))
if (!CharacterDatabase.Open(dbstring, async_threads, connections))
{
sLog.outError("Cannot connect to Character database %s", dbstring.c_str());
return false;
@@ -485,10 +485,10 @@ bool Master::_StartDB()
return false;
}
synch_threads = sConfig.GetIntDefault("LoginDatabase.SynchThreads", 1);
connections = sConfig.GetIntDefault("LoginDatabase.Connections", 2);
///- Initialise the login database
if (!LoginDatabase.Open(dbstring, async_threads, synch_threads))
if (!LoginDatabase.Open(dbstring, async_threads, connections))
{
sLog.outError("Cannot connect to login database %s", dbstring.c_str());
return false;