From a9e9a2c8848c22e4a3e3b7bab0caeca25d9ea408 Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Mon, 27 Sep 2010 00:20:56 +0200 Subject: Core/DBLayer: - DB Threading model update * Get rid of ThreadBundleMask and bundled connection * Implement configurable amount of Synch threads for databasepools * Use modulus based algorithm to check for free synchronous connections instead of previous ¨get connection by thread key or bundlemask¨ feature * Locks on mysql context objects are now managed outside the mysql query methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes issue #4058 Fixes issue #4059 Introduces a ton of more issues. Use at own risk. You were warned. Really. Don´t forget to update your worldserver.conf --HG-- branch : trunk --- src/server/authserver/Main.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/server/authserver/Main.cpp') diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index d23aecf3313..f92949aadc5 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -339,15 +339,22 @@ bool StartDB() return false; } - uint8 num_threads = sConfig.GetIntDefault("LoginDatabase.WorkerThreads", 1); - if (num_threads < 1 || num_threads > 32) + uint8 worker_threads = sConfig.GetIntDefault("LoginDatabase.WorkerThreads", 1); + if (worker_threads < 1 || worker_threads > 32) { sLog.outError("Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1."); - num_threads = 1; + worker_threads = 1; } - //- Authserver has singlethreaded synchronous DB access, hence MYSQL_BUNDLE_ALL - if (!LoginDatabase.Open(dbstring.c_str(), num_threads, MYSQL_BUNDLE_ALL)) + uint8 synch_threads = sConfig.GetIntDefault("LoginDatabase.SynchThreads", 1); + if (synch_threads < 1 || synch_threads > 32) + { + sLog.outError("Improper value specified for LoginDatabase.SynchThreads, defaulting to 1."); + synch_threads = 1; + } + + /// NOTE: While authserver is singlethreaded you should keep synch_threads == 1. Increasing it is just silly since only 1 will be used ever. + if (!LoginDatabase.Open(dbstring.c_str(), worker_threads, synch_threads)) { sLog.outError("Cannot connect to database"); return false; -- cgit v1.2.3