[mapguide-commits] r5779 - trunk/MgDev/Server/src/Services/Resource

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu May 12 02:20:58 EDT 2011


Author: hubu
Date: 2011-05-11 23:20:58 -0700 (Wed, 11 May 2011)
New Revision: 5779

Modified:
   trunk/MgDev/Server/src/Services/Resource/DbEnvironment.cpp
   trunk/MgDev/Server/src/Services/Resource/DbEnvironment.h
Log:
Fix Ticket: https://trac.osgeo.org/mapguide/ticket/1687
Reviewed by Bruce Dechant.

Modified: trunk/MgDev/Server/src/Services/Resource/DbEnvironment.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Resource/DbEnvironment.cpp	2011-05-11 08:55:49 UTC (rev 5778)
+++ trunk/MgDev/Server/src/Services/Resource/DbEnvironment.cpp	2011-05-12 06:20:58 UTC (rev 5779)
@@ -42,12 +42,23 @@
     m_dbEnv.set_error_stream(&std::cerr);
 #endif
 
-    m_dbEnv.set_cachesize(0, MG_CACHE_SIZE, 1);
-    m_dbEnv.set_lg_bsize(MG_LOG_BUF_SIZE);
+    // Set the cache size based on the repository type
+    if(MgRepositoryType::Session == repositoryType)
+    {
+        // Session repository
+        m_dbEnv.set_cachesize(0, MG_SESSION_CACHE_SIZE, 1);
+        m_dbEnv.set_lg_bsize(MG_SESSION_LOG_BUF_SIZE);
+    }
+    else
+    {
+        // Library repository
+        m_dbEnv.set_cachesize(0, MG_LIBRARY_CACHE_SIZE, 1);
+        m_dbEnv.set_lg_bsize(MG_LIBRARY_LOG_BUF_SIZE);
+    }
+
     m_dbEnv.set_timeout(MG_DB_ENV_TIMEOUT, DB_SET_LOCK_TIMEOUT);
     m_dbEnv.set_timeout(MG_DB_ENV_TIMEOUT, DB_SET_TXN_TIMEOUT);
     m_dbEnv.set_tx_max(MG_MAX_TRANSACTIONS);
-    m_dbEnv.set_tx_max(40); // Set maximum number of allowed transactions. Default is 20
 
     u_int32_t containerFlags = DB_CREATE|DB_THREAD|DBXML_NO_INDEX_NODES;
     u_int32_t environmentFlags = DB_CREATE|DB_THREAD|DB_INIT_MPOOL;

Modified: trunk/MgDev/Server/src/Services/Resource/DbEnvironment.h
===================================================================
--- trunk/MgDev/Server/src/Services/Resource/DbEnvironment.h	2011-05-11 08:55:49 UTC (rev 5778)
+++ trunk/MgDev/Server/src/Services/Resource/DbEnvironment.h	2011-05-12 06:20:58 UTC (rev 5779)
@@ -22,17 +22,19 @@
 
 // All sizes must be in powers-of-two.
 // TODO: Determine the best sizes to improve the Server performance.
-static const u_int32_t MG_KB                = 1024;
-static const u_int32_t MG_MB                = 1048576; // 1024^2
-static const u_int32_t MG_CACHE_SIZE        = 32 * MG_MB;
-static const u_int32_t MG_DB_PAGE_SIZE      = 32 * MG_KB;
-static const u_int32_t MG_DBXML_PAGE_SIZE   = 32 * MG_KB;
-static const u_int32_t MG_LOG_BUF_SIZE      = 12 * MG_MB;
-static const u_int32_t MG_MAX_TRANSACTIONS  = 1000;
-static const u_int32_t MG_SESS_DB_PAGE_SIZE = 2 * MG_KB;
+static const u_int32_t MG_KB                   = 1024;
+static const u_int32_t MG_MB                   = 1048576; // 1024^2
+static const u_int32_t MG_LIBRARY_CACHE_SIZE   = 32 * MG_MB;
+static const u_int32_t MG_SESSION_CACHE_SIZE   = 2 * MG_MB;
+static const u_int32_t MG_DB_PAGE_SIZE         = 32 * MG_KB;
+static const u_int32_t MG_DBXML_PAGE_SIZE      = 32 * MG_KB;
+static const u_int32_t MG_LIBRARY_LOG_BUF_SIZE = 12 * MG_MB;
+static const u_int32_t MG_SESSION_LOG_BUF_SIZE = 1 * MG_MB;
+static const u_int32_t MG_MAX_TRANSACTIONS     = 1000;
+static const u_int32_t MG_SESS_DB_PAGE_SIZE    = 2 * MG_KB;
 static const u_int32_t MG_SESS_DBXML_PAGE_SIZE = 512;
 // Set lock and transaction timeout to 0.2 seconds
-static const u_int32_t MG_DB_ENV_TIMEOUT = 200000;
+static const u_int32_t MG_DB_ENV_TIMEOUT       = 200000;
 
 class MgDatabase;
 



More information about the mapguide-commits mailing list