[mapguide-commits] r6067 - in trunk/MgDev:
Common/MapGuideCommon/System Server/src/Core
Server/src/Services/Resource
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Aug 15 02:53:28 EDT 2011
Author: christinebao
Date: 2011-08-14 23:53:28 -0700 (Sun, 14 Aug 2011)
New Revision: 6067
Modified:
trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
trunk/MgDev/Server/src/Core/serverconfig.ini
trunk/MgDev/Server/src/Services/Resource/DbEnvironment.cpp
trunk/MgDev/Server/src/Services/Resource/DbEnvironment.h
trunk/MgDev/Server/src/Services/Resource/ResourceDatabase.cpp
Log:
Fix ticket http://trac.osgeo.org/mapguide/ticket/1779
Load MGP file failed with huge template maps
Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp 2011-08-14 16:56:39 UTC (rev 6066)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp 2011-08-15 06:53:28 UTC (rev 6067)
@@ -472,6 +472,33 @@
const STRING MgConfigProperties::DefaultTraceLogPropertyParameters = L"";
// ******************************************************************
+// DB Environment Properties
+// ******************************************************************
+const STRING MgConfigProperties::DBEnvironmentPropertiesSection = L"DBEnvironmentProperties";
+const STRING MgConfigProperties::LibraryCacheSizeParameters = L"LibraryCacheSize";
+const INT32 MgConfigProperties::DefaultLibraryCacheSizeParameters = 32;
+const STRING MgConfigProperties::SessionCacheSizeParamters = L"SessionCacheSize";
+const INT32 MgConfigProperties::DefaultSessionCacheSizeParamters = 2;
+const STRING MgConfigProperties::DBPageSizeParameters = L"DBPageSize";
+const INT32 MgConfigProperties::DefaultDBPageSizeParameters = 32;
+const STRING MgConfigProperties::DBXMLPageSizeParameters = L"DBXMLPageSize";
+const INT32 MgConfigProperties::DefaultDBXMLPageSizeParameters = 32;
+const STRING MgConfigProperties::LibraryLogBufferSizeParameters = L"LibraryLogBufferSize";
+const INT32 MgConfigProperties::DefaultLibraryLogBufferSizeParameters = 12;
+const STRING MgConfigProperties::SessionLogBufferSizeParameters = L"SessionLogBufferSize";
+const INT32 MgConfigProperties::DefaultSessionLogBufferSizeParameters = 1;
+const STRING MgConfigProperties::DBMaxTransactionsParamters = L"DBMaxTransactions";
+const INT32 MgConfigProperties::DefaultDBMaxTransactionsParamters = 1000;
+const STRING MgConfigProperties::SessionDBPageSizeParameters = L"SessionDBPageSize";
+const INT32 MgConfigProperties::DefaultSessionDBPageSizeParameters = 2;
+const STRING MgConfigProperties::SessionDBXMLPageSizeParameters = L"SessionDBXMLPageSize";
+const double MgConfigProperties::DefaultSessionDBXMLPageSizeParameters = 0.5;
+const STRING MgConfigProperties::DBTimeoutParameters = L"DBTimeout";
+const double MgConfigProperties::DefaultDBTimeoutParameters = 0.2;
+const STRING MgConfigProperties::DBMaxLockersParameters = L"DBMaxLockers";
+const INT32 MgConfigProperties::DefaultDBMaxLockersParameters = 1000;
+
+// ******************************************************************
// Support Servers section
// ******************************************************************
const STRING MgConfigProperties::SupportServersSection = L"SupportServers";
@@ -743,6 +770,21 @@
{ L"" , 0 , 0.0 , 0.0 , L"" }
};
+const MgConfigValidationInfo MgConfigProperties::sm_cviDBEnvironmentProperties[] =
+{
+ { MgConfigProperties::LibraryCacheSizeParameters , MgPropertyType::Int32 , 1 , 1024 , L"" },
+ { MgConfigProperties::SessionCacheSizeParamters , MgPropertyType::Int32 , 1 , 1024 , L"" },
+ { MgConfigProperties::DBPageSizeParameters , MgPropertyType::Int32 , 1 , 1024 , L"" },
+ { MgConfigProperties::DBXMLPageSizeParameters , MgPropertyType::Int32 , 1 , 1024 , L"" },
+ { MgConfigProperties::LibraryLogBufferSizeParameters , MgPropertyType::Int32 , 1 , 1024 , L"" },
+ { MgConfigProperties::SessionLogBufferSizeParameters , MgPropertyType::Int32 , 1 , 1024 , L"" },
+ { MgConfigProperties::DBMaxTransactionsParamters , MgPropertyType::Int32 , 1 , 1000000 , L"" },
+ { MgConfigProperties::SessionDBPageSizeParameters , MgPropertyType::Int32 , 1 , 1024 , L"" },
+ { MgConfigProperties::SessionDBXMLPageSizeParameters , MgPropertyType::Double , 0.0 , 0.0 , L"" },
+ { MgConfigProperties::DBTimeoutParameters , MgPropertyType::Double , 0.0 , 0.0 , L"" },
+ { MgConfigProperties::DBMaxLockersParameters , MgPropertyType::Int32 , 1 , 1000000 , L"" },
+};
+
///////////////////////////////////////////////////////////////////////////////
/// Web Configuration Validation Information Maps
///
Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h 2011-08-14 16:56:39 UTC (rev 6066)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h 2011-08-15 06:53:28 UTC (rev 6067)
@@ -808,6 +808,55 @@
static const STRING TraceLogPropertyParameters; /// value("Parameters")
static const STRING DefaultTraceLogPropertyParameters; /// value("")
+ /// DB Environment PROPERTIES SECTION -------------------------------------------------------------------------------
+
+ /// DB Environment properties. This is for setting DB Environment.
+ static const STRING DBEnvironmentPropertiesSection; /// value("DBEnvironmentProperties")
+
+ /// The size for library cache size in MB
+ static const STRING LibraryCacheSizeParameters; /// value("LibraryCacheSize")
+ static const INT32 DefaultLibraryCacheSizeParameters; /// value(32)
+
+ /// The size for session cache size in MB
+ static const STRING SessionCacheSizeParamters; /// value("SessionCacheSize")
+ static const INT32 DefaultSessionCacheSizeParamters; /// value(2)
+
+ /// The size for library DB page in KB
+ static const STRING DBPageSizeParameters; /// value("DBPageSize")
+ static const INT32 DefaultDBPageSizeParameters; /// value(32)
+
+ /// The size for library DBXML page in KB
+ static const STRING DBXMLPageSizeParameters; /// value("DBXMLPageSize")
+ static const INT32 DefaultDBXMLPageSizeParameters; /// value(32)
+
+ /// The size for library log buffer in MB
+ static const STRING LibraryLogBufferSizeParameters; /// value("LibraryLogBufferSize")
+ static const INT32 DefaultLibraryLogBufferSizeParameters; /// value(12)
+
+ /// The size for session log buffer in MB
+ static const STRING SessionLogBufferSizeParameters; /// value("SessionLogBufferSize")
+ static const INT32 DefaultSessionLogBufferSizeParameters; /// value(1)
+
+ /// The max number of DB transactions
+ static const STRING DBMaxTransactionsParamters; /// value("DBMaxTransactions")
+ static const INT32 DefaultDBMaxTransactionsParamters; /// value(1000)
+
+ /// The size for session DB page in KB
+ static const STRING SessionDBPageSizeParameters; // value("SessionDBPageSize")
+ static const INT32 DefaultSessionDBPageSizeParameters; // value(2)
+
+ /// The size for session DBXML page in KB
+ static const STRING SessionDBXMLPageSizeParameters; // value("SessionDBXMLPageSize")
+ static const double DefaultSessionDBXMLPageSizeParameters; // value(0.5)
+
+ /// The time out for lock and transaction in second
+ static const STRING DBTimeoutParameters; // value("DBTimeout")
+ static const double DefaultDBTimeoutParameters; // value(0.2)
+
+ /// The max number of DB lockers
+ static const STRING DBMaxLockersParameters; // value("DBMaxLockers")
+ static const INT32 DefaultDBMaxLockersParameters; // value(1000)
+
INTERNAL_API:
/// SUPPORT SERVERS SECTION -----------------------------------------------------------------------------------------
@@ -931,6 +980,7 @@
static const MgConfigValidationInfo sm_cviPerformanceLogProperties[];
static const MgConfigValidationInfo sm_cviSessionLogProperties[];
static const MgConfigValidationInfo sm_cviTraceLogProperties[];
+ static const MgConfigValidationInfo sm_cviDBEnvironmentProperties[];
// Web Configuration Validation Information Maps
static const MgConfigValidationInfo sm_cviAgentProperties[];
Modified: trunk/MgDev/Server/src/Core/serverconfig.ini
===================================================================
--- trunk/MgDev/Server/src/Core/serverconfig.ini 2011-08-14 16:56:39 UTC (rev 6066)
+++ trunk/MgDev/Server/src/Core/serverconfig.ini 2011-08-15 06:53:28 UTC (rev 6067)
@@ -577,3 +577,34 @@
# U N M A N A G E D D A T A M A P P I N G S
# This section is used to map a mapping name to an unmanaged data folder.
# *****************************************************************************
+
+[DBEnvironmentProperties]
+# *****************************************************************************
+# DB ENVIRONMENT
+# This section is to set DB Environment. Determine the best sizes to improve the Server performance.
+#
+# Property Name Description
+# -----------------------------------------------------------------------------
+# LibraryCacheSize The size for library cache size in MB
+# SessionCacheSize The size for session cache size in MB
+# DBPageSize The size for library DB page in KB
+# DBXMLPageSize The size for library DBXML page in KB
+# LibraryLogBufferSize The size for library log buffer in MB
+# SessionLogBufferSize The size for session log buffer in MB
+# DBMaxTransactions The max number of DB transactions
+# SessionDBPageSize The size for session DB page in KB
+# SessionDBXMLPageSize The size for session DBXML page in KB
+# DBTimeout The time out for lock and transaction in second
+# DBMaxLockers The max number of DB lockers
+# *****************************************************************************
+LibraryCacheSize = 32
+SessionCacheSize = 2
+DBPageSize = 32
+DBXMLPageSize = 32
+LibraryLogBufferSize = 12
+SessionLogBufferSize = 1
+DBMaxTransactions = 1000
+SessionDBPageSize = 2
+SessionDBXMLPageSize = 0.5
+DBTimeout = 0.2
+DBMaxLockers = 1000
Modified: trunk/MgDev/Server/src/Services/Resource/DbEnvironment.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Resource/DbEnvironment.cpp 2011-08-14 16:56:39 UTC (rev 6066)
+++ trunk/MgDev/Server/src/Services/Resource/DbEnvironment.cpp 2011-08-15 06:53:28 UTC (rev 6067)
@@ -42,6 +42,100 @@
m_dbEnv.set_error_stream(&std::cerr);
#endif
+ // read sizes from config file
+ MgConfiguration* configuration = MgConfiguration::GetInstance();
+ ACE_ASSERT(NULL != configuration);
+ INT32 libraryCacheSize = MgConfigProperties::DefaultLibraryCacheSizeParameters; // MG_LIBRARY_CACHE_SIZE = 32 * MG_MB;
+ INT32 sessionCacheSize = MgConfigProperties::DefaultSessionCacheSizeParamters; // MG_SESSION_CACHE_SIZE = 2 * MG_MB;
+ INT32 dbPageSize = MgConfigProperties::DefaultDBPageSizeParameters; //MG_DB_PAGE_SIZE = 32 * MG_KB;
+ INT32 dbXMLPageSize = MgConfigProperties::DefaultDBXMLPageSizeParameters; //MG_DBXML_PAGE_SIZE = 32 * MG_KB;
+ INT32 libraryLogBufSize = MgConfigProperties::DefaultLibraryLogBufferSizeParameters; // MG_LIBRARY_LOG_BUF_SIZE = 12 * MG_MB;
+ INT32 sessionLogBufSize = MgConfigProperties::DefaultSessionLogBufferSizeParameters; //MG_SESSION_LOG_BUF_SIZE = 1 * MG_MB;
+ INT32 maxTransaction = MgConfigProperties::DefaultDBMaxTransactionsParamters; //MG_MAX_TRANSACTIONS = 1000;
+ INT32 sessionDBPageSize = MgConfigProperties::DefaultSessionDBPageSizeParameters; //MG_SESS_DB_PAGE_SIZE = 2 * MG_KB;
+ double sessionDBXMLPageSize = MgConfigProperties::DefaultSessionDBXMLPageSizeParameters; //MG_SESS_DBXML_PAGE_SIZE = 512;
+ double timeout = MgConfigProperties::DefaultDBTimeoutParameters; // MG_DB_ENV_TIMEOUT = 0.2 * MG_MICROSECOND;
+ INT32 maxLocker = MgConfigProperties::DefaultDBMaxLockersParameters;
+ if (NULL != configuration)
+ {
+ configuration->GetIntValue(
+ MgConfigProperties::DBEnvironmentPropertiesSection,
+ MgConfigProperties::LibraryCacheSizeParameters,
+ libraryCacheSize,
+ MgConfigProperties::DefaultLibraryCacheSizeParameters);
+
+ configuration->GetIntValue(
+ MgConfigProperties::DBEnvironmentPropertiesSection,
+ MgConfigProperties::SessionCacheSizeParamters,
+ sessionCacheSize,
+ MgConfigProperties::DefaultSessionCacheSizeParamters);
+
+ configuration->GetIntValue(
+ MgConfigProperties::DBEnvironmentPropertiesSection,
+ MgConfigProperties::DBPageSizeParameters,
+ dbPageSize,
+ MgConfigProperties::DefaultDBPageSizeParameters);
+
+ configuration->GetIntValue(
+ MgConfigProperties::DBEnvironmentPropertiesSection,
+ MgConfigProperties::DBXMLPageSizeParameters,
+ dbXMLPageSize,
+ MgConfigProperties::DefaultDBXMLPageSizeParameters);
+
+ configuration->GetIntValue(
+ MgConfigProperties::DBEnvironmentPropertiesSection,
+ MgConfigProperties::LibraryLogBufferSizeParameters,
+ libraryLogBufSize,
+ MgConfigProperties::DefaultLibraryLogBufferSizeParameters);
+
+ configuration->GetIntValue(
+ MgConfigProperties::DBEnvironmentPropertiesSection,
+ MgConfigProperties::SessionLogBufferSizeParameters,
+ sessionLogBufSize,
+ MgConfigProperties::DefaultSessionLogBufferSizeParameters);
+
+ configuration->GetIntValue(
+ MgConfigProperties::DBEnvironmentPropertiesSection,
+ MgConfigProperties::DBMaxTransactionsParamters,
+ maxTransaction,
+ MgConfigProperties::DefaultDBMaxTransactionsParamters);
+
+ configuration->GetIntValue(
+ MgConfigProperties::DBEnvironmentPropertiesSection,
+ MgConfigProperties::SessionDBPageSizeParameters,
+ sessionDBPageSize,
+ MgConfigProperties::DefaultSessionDBPageSizeParameters);
+
+ configuration->GetDoubleValue(
+ MgConfigProperties::DBEnvironmentPropertiesSection,
+ MgConfigProperties::SessionDBXMLPageSizeParameters,
+ sessionDBXMLPageSize,
+ MgConfigProperties::DefaultSessionDBXMLPageSizeParameters);
+
+ configuration->GetDoubleValue(
+ MgConfigProperties::DBEnvironmentPropertiesSection,
+ MgConfigProperties::DBTimeoutParameters,
+ timeout,
+ MgConfigProperties::DefaultDBTimeoutParameters);
+
+ configuration->GetIntValue(
+ MgConfigProperties::DBEnvironmentPropertiesSection,
+ MgConfigProperties::DBMaxLockersParameters,
+ maxLocker,
+ MgConfigProperties::DefaultDBMaxLockersParameters);
+ }
+ MG_LIBRARY_CACHE_SIZE = libraryCacheSize * MG_MB; //32 * MG_MB by default
+ MG_SESSION_CACHE_SIZE = sessionCacheSize * MG_MB; //2 * MG_MB by default
+ MG_DB_PAGE_SIZE = dbPageSize * MG_KB; //32 * MG_KB by default
+ MG_DBXML_PAGE_SIZE = dbXMLPageSize * MG_KB; //32 * MG_KB by default
+ MG_LIBRARY_LOG_BUF_SIZE = libraryLogBufSize * MG_MB; //12 * MG_MB by default
+ MG_SESSION_LOG_BUF_SIZE = sessionLogBufSize * MG_MB; //1 * MG_MB by default
+ MG_MAX_TRANSACTIONS = maxTransaction; //1000 by default
+ MG_SESS_DB_PAGE_SIZE = sessionDBPageSize * MG_KB; //2 * MG_KB by default
+ MG_SESS_DBXML_PAGE_SIZE = sessionDBXMLPageSize * MG_KB; //512 by default
+ MG_DB_ENV_TIMEOUT = timeout * MG_MICROSECOND; //0.2 * MG_MICROSECOND by default
+ MG_MAX_LOCKS = maxLocker; //1000 by default
+
// Set the cache size based on the repository type
if(MgRepositoryType::Session == repositoryType)
{
@@ -59,6 +153,9 @@
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_lk_max_lockers(MG_MAX_LOCKS);
+ m_dbEnv.set_lk_max_locks(MG_MAX_LOCKS);
+ m_dbEnv.set_lk_max_objects(MG_MAX_LOCKS);
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-08-14 16:56:39 UTC (rev 6066)
+++ trunk/MgDev/Server/src/Services/Resource/DbEnvironment.h 2011-08-15 06:53:28 UTC (rev 6067)
@@ -24,17 +24,7 @@
// 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_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_MICROSECOND = 1000000;
class MgDatabase;
@@ -69,6 +59,9 @@
void PerformCheckpoint(UINT32 flags = 0);
void ResetDatabase(MgDatabase& database);
+ INT32 getDBPageSize();
+ INT32 getSessionDBPageSize();
+
/// Data Members
private:
@@ -78,6 +71,19 @@
DbEnv m_dbEnv;
XmlManager m_xmlMan;
MgXmlSchemaResolver m_schemaResolver;
+
+ //configurable settings
+ INT32 MG_LIBRARY_CACHE_SIZE; //32 * MG_MB by default
+ INT32 MG_SESSION_CACHE_SIZE; //2 * MG_MB by default
+ INT32 MG_DB_PAGE_SIZE; //32 * MG_KB by default
+ INT32 MG_DBXML_PAGE_SIZE; //32 * MG_KB by default
+ INT32 MG_LIBRARY_LOG_BUF_SIZE; //12 * MG_MB by default
+ INT32 MG_SESSION_LOG_BUF_SIZE; //1 * MG_MB by default
+ INT32 MG_MAX_TRANSACTIONS; //1000 by default
+ INT32 MG_SESS_DB_PAGE_SIZE; //2 * MG_KB by default
+ double MG_SESS_DBXML_PAGE_SIZE; //512 by default
+ double MG_DB_ENV_TIMEOUT; //0.2 * MG_MICROSECOND by default
+ INT32 MG_MAX_LOCKS; //1000 by default
};
/// Inline Methods
@@ -102,4 +108,14 @@
return m_schemaResolver;
}
+INT32 MgDbEnvironment::getDBPageSize()
+{
+ return MG_DB_PAGE_SIZE;
+}
+
+INT32 MgDbEnvironment::getSessionDBPageSize()
+{
+ return MG_SESS_DB_PAGE_SIZE;
+}
+
#endif
Modified: trunk/MgDev/Server/src/Services/Resource/ResourceDatabase.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Resource/ResourceDatabase.cpp 2011-08-14 16:56:39 UTC (rev 6066)
+++ trunk/MgDev/Server/src/Services/Resource/ResourceDatabase.cpp 2011-08-15 06:53:28 UTC (rev 6067)
@@ -44,11 +44,11 @@
if (fileName.find(MG_WCHAR_TO_CHAR(MgRepositoryType::Session)) == fileName.npos)
{
- m_db.set_pagesize(MG_DB_PAGE_SIZE);
+ m_db.set_pagesize(environment.getDBPageSize());
}
else
{
- m_db.set_pagesize(MG_SESS_DB_PAGE_SIZE);
+ m_db.set_pagesize(environment.getSessionDBPageSize());
}
if (m_environment.IsTransacted())
More information about the mapguide-commits
mailing list