MapGuide Enterprise/OpenSource是通过FDO连接到数据源的。在访问数据源的过程中,MGServer会创建到数据源的FDO连接。为提高性能,连接使用完毕后并不是马上释放,而是放在一个连接池(ConnectionPool)中,下次再使用该FDO连接时,可以先查找连接池中是否有空闲连接,如有空间连接,直接使用连接池中的连接从而省去创建连接的开销;如果连接池中没有可用连接时才会去重新创建,使用完毕后在放置到连接池中。
对应连接池的大小,缺省是200个,但对于不同的FDO连接类型,我们也可以自定义连接池的大小。这些参数就存储在ServerConfig.ini(C:\Program Files\Autodesk\MapGuideEnterprise2010\Server\Bin\serverconfig.ini)文件中。
[FeatureServiceProperties]
# ***************************************************************************** # F E A T U R E S E R V I C E # # Property Name Description # ----------------------------------------------------------------------------- # CacheSize Max # of internal data objects to cache # (schemas, classes, etc...) # 0 < Value <= 5000 # CacheTimeLimit Time duration in seconds for how long to # cache the internal data objects # 0 < Value <= 2147483647 # CacheTimerInterval Time interval in seconds for when the server # checks for expired cache entries # 0 < Value <= 2147483647 # DataCacheSize Max # of features to fetch # 0 < Value <= 2147483647 # DataConnectionPoolEnabled FDO connection pooling # 0 = disabled, 1 = enabled # DataConnectionPoolExcludedProviders The list of providers to exclude from connection pooling. # 0 <= Length <= 1024 # Value = provider name(s) separated by "," # Example: OSGeo.SDF,OSGeo.SHP # DataConnectionPoolSize Default # of FDO connections to cache per provider # 1 < Value <= 1024 # DataConnectionPoolSizeCustom Custom # of FDO connections to cache for specified provider # 0 <= Length <= 1024 # Example: OSGeo.SDF:10,OSGeo.SHP:10 # DataConnectionTimeout Time duration in seconds for when an idle FDO # connection is dropped # 0 < Value <= 2147483647 # DataConnectionTimerInterval Time interval in seconds for when the server # checks for idle FDO connections # 0 < Value <= 2147483647 # JoinQueryBatchSize Join query batch size # 1 < Value <= 10000 # ***************************************************************************** JoinQueryBatchSize = 1000 DataConnectionTimerInterval = 3600 DataConnectionTimeout = 28800 DataConnectionPoolSizeCustom = OSGeo.Gdal:1 DataConnectionPoolSize = 200 DataConnectionPoolExcludedProviders = OSGeo.SDF,OSGeo.SHP DataConnectionPoolEnabled = 1 DataCacheSize = 100 CacheTimerInterval = 3600 CacheTimeLimit = 86400 CacheSize = 100
如果我们想设置某种FDO连接的连接池大小,我们就可以通过更改这个配置文件来实现。比如我们需要自定义到ArcSDE的FDO连接池的大小为50个,可以通过更改DataConnectionPoolSizeCustom实现:
DataConnectionPoolSizeCustom = OSGeo.Gdal:1, OSGeo.ArcSDE:50
更改保存完毕,需要重新启动MGServer使改到生效。
另外我们可以通过MapAgent中的测试页面监视FDO连接的使用状况:
通过 在左边的Feature下的 GetFdoCacheInfo API来查看:
下面是我的MGServer某一时刻的使用状况:
-2009-11-17T17:48:29.702633 -- True OSGeo.SDF,OSGeo.SHP 200 OSGeo.Gdal:1 28800 - Autodesk.Oracle 200 1 0 FdoThreadCapability_PerConnectionThreaded True -Library://Samples/Sheboygan/Data/Ora.FeatureSource Open False LIVE 2009-11-17T10:24:02 True - OSGeo.Gdal 1 0 0 Not initialized. True OSGeo.SDF 200 0 0 FdoThreadCapability_PerConnectionThreaded False
好了,如果你需要为FDO连接池的大小做定制的话,试试这个吧! Cheers!
有任何意见建议欢迎评论或到讨论。
转载请注明出处及作者 Daniel Du 杜长宇