When you deploy AIMS or MapGuide according to the default configuration, you may find that the performance of this system is not very good. If you have more concurrent users, the MapGuide Server will die. This is because the default configuration of MapGuide is only a secure setting that can be run in most machine configurations. However, if you apply this default configuration to the official production environment, performance will cause problems. We must optimize the configuration of the MapGuide Server according to the actual situation. You can adjust the settings in serverConfig. ini. The default file is in the C: \ Program Files \ Autodesk Infrastructure Map Server 2013 \ Bin directory.
How many changes are appropriate for those parameters? To better optimize the performance by modifying the parameters in serverConfig. ini in MapGuide, let's test the stress and see if there is a problem in that process. There are many tools for Stress testing, such as Grinder, LoadRunner, and Microsoft Web Application Stress Tool. You can use tools you are familiar.
Next I will use Grinder to test my AIMS site. Grinder is an open-source stress testing tool, which can be downloaded from here. I will perform a stress test on the Sheboyon sample data. Here is a test script written by someone else. This script tests the following eight common operations, including loading map viewer and element query, roaming, scaling, selection, and clearing options. For more information, see the test script Script_BasicNet2010.py.
Let's talk about my testing environment, my notebook:
Intel Core i7 Q820@1.73G
When I started testing with 8 GB memory, I used 3.2 GB memory. I started some common programs, including LiveWriter, which is currently used to write blogs.
Windows 7 64-bit
Autodesk Infrastructure Map Server 2013 64-bit
The following is the test method:
1. Install the test environment
Grinder is written based on Java. First, you need to configure the Java environment. I will not elaborate on it here. There are a lot of searches on the Internet.
Download Grinder,
Download the test script and decompress it.
2. Modify test Script Parameters
Modify the MapGuide stress test script of Grinder. Because this script is used to test the Sheboygan sample data, if you do not have this sample data, you can download it from OSGeo, of course, if you need to test your own data, you need to change the test script. Here I will first test the Sheboygon data.
The default setting of the script is http: // localhost/mapguide. The PHP version of MapGuide is used for testing for one user. I installed the. net version of Autodesk Infrastructure Map Server 2013, so I need to change the parameters.
Open scripts/grinder. properties and change it:
Grinder. script = sheboyganNet. Py test the. net version of AIMS
Grinder. processes = 10 10 concurrent users
Grinder. threads = 1
Grinder. runs = 0
Then open SheboyganNet. py and change RARAM_BaseUrl to http: // localhost/mapserver2013 /.
Execfile ('. \ scripts \ params_basic2010.py ')
Execfile ('. \ scripts \ Params_SheboyganCommon.py ')
# Mapguide Server url
PARAM_BaseUrl ="Http: // localhost/mapserver2013 /"
PARAM_WebLayout = "Library: // Samples/Sheboygan/Layouts/SheboyganAsp. WebLayout"
PARAM_MapDefinition = "Library: // Samples/Sheboygan/Maps/Sheboygan. MapDefinition"
PARAM_MapName = "Sheboygan"
PARAM_InitialLegendLayers = ["Library: // Samples/Sheboygan/Layers/Islands. LayerDefinition ",
"Library: // Samples/Sheboygan/Layers/Hydrography. LayerDefinition ",
"Library: // Samples/Sheboygan/Layers/CityLimits. LayerDefinition ",
"Library: // Samples/Sheboygan/Layers/Districts. LayerDefinition ",
"Library: // Samples/Sheboygan/Layers/Parcels. LayerDefinition"]
Execfile ('. \ scripts \ script_basicnet2010.py ')
3. Run the test
If you are running Grinder for the first time, first run SetClasspath. bat to add the relevant library of Grinder to classpath, and then run it once.
Double-click StartConsole. bat to start the Console
Double-click StartAgent. bat to start the agent
In the console, start the process through the Action menu. Here is a document about the grinder console.
Run a stress test on 10 concurrent users on the default installation settings of AIMS 2013. The following Error occurs in Error. log in a short time, indicating that a new session cannot be created.
<2012-08-30T16: 00: 53> 74620 127.0.0.1 Administrator
Error:Cannot create repository: Session: D20be822-f278-11e1-8000-1cc1de9ea86d_en_MTI3LjAuMC4x0AF20AF10AF0 //
StackTrace:
-MgSiteServiceHandler. ProcessOperation () line 83 file d: \ build \ ims2013 \ build_52.8 \ ent \ OS \ server \ src \ services \ site \ SiteServiceHandler. cpp
-MgOpCreateSession. Execute () line 109 file d: \ build \ ims2013 \ build_52.8 \ ent \ OS \ server \ src \ services \ site \ OpCreateSession. cpp
-MgServerSiteService. CreateSession () line 762 file d: \ build \ ims2013 \ build_52.8 \ ent \ OS \ server \ src \ services \ site \ ServerSiteService. cpp
-MgServerResourceService. CreateRepository () line 491 file d: \ build \ ims2013 \ build_52.8 \ ent \ OS \ server \ src \ services \ resource \ ServerResourceService. cpp
<2012-08-30T16: 00: 53> 74820 127.0.0.1 Administrator
Error: Cannot create repository: Session: d203d196-f278-11e1-8000-1cc1de9ea86d_en_MTI3LjAuMC4x0AF20AF10AF0 //
StackTrace:
-MgSiteServiceHandler. ProcessOperation () line 83 file d: \ build \ ims2013 \ build_52.8 \ ent \ OS \ server \ src \ services \ site \ SiteServiceHandler. cpp
-MgOpCreateSession. Execute () line 109 file d: \ build \ ims2013 \ build_52.8 \ ent \ OS \ server \ src \ services \ site \ OpCreateSession. cpp
-MgServerSiteService. CreateSession () line 762 file d: \ build \ ims2013 \ build_52.8 \ ent \ OS \ server \ src \ services \ site \ ServerSiteService. cpp
-MgServerResourceService. CreateRepository () line 491 file d: \ build \ ims2013 \ build_52.8 \ ent \ OS \ server \ src \ services \ resource \ ServerResourceService. cpp
So how to optimize it? Go to serverConfig. ini and modify the parameter configuration as follows. Pay attention to the highlighted part.
[ResourceServiceProperties]
#*************************************** **************************************
# R E S O U R C E S E R V I C E
#
# Property Name Description
#-----------------------------------------------------------------------------
# LibraryRepositoryPath Path where the Library repository is stored
# LibraryResourceDataFilePath Path where the Library resource data files
# Are stored
# PackagesPath Path where the resource packages can be found
# RepositoryCheckpointsTimerInterval Time duration in seconds for when the server
# Performs checkpoints for all the repositories
#0 <Value <= 2147483647
# ResourceChangeTimerInterval Time duration in seconds for when the server
# Dispatches resource change specifications
#0 <Value <= 2147483647
# ResourceDataFileTrashFolderName Folder where the repository trash files are
# Stored
# ResourcePermissionCacheSize Max # of resources with permission
# Information to be cached
#0 <= Value <= 2147483647
# ResourceSchemaFilePath Path where the resource schema files are
# Stored
# SessionRepositoriesConfig Sets whether to use a single file session
# Repository or a session repository file per session.
# SingleFile or FilePerSession
# SessionRepositoriesLimit The total number of active session files allowed.
# This setting only works when FilePerSession
# Is used.
# SessionRepositoryPath Path where the Session repository is stored
# SessionResourceDataFilePath Path where the Session resource data files
# Are stored
# SiteRepositoryPath Path where the Site repository is stored
#*************************************** **************************************
LibraryRepositoryPath = C: \ Program Files \ Autodesk Infrastructure Map Server 2013 \ Repositories \ Library \
LibraryResourceDataFilePath = C: \ Program Files \ Autodesk Infrastructure Map Server 2013 \ Repositories \ Library \ DataFiles \
PackagesPath = C: \ Program Files \ Autodesk Infrastructure Map Server 2013 \ Packages \
RepositoryCheckpointsTimerInterval = 600
ResourceChangeTimerInterval = 5
ResourceDataFileTrashFolderName = Trash
Thinkermissioncachesize = 1000
ResourceSchemaFilePath = C: \ Program Files \ Autodesk Infrastructure Map Server 2013 \ Schema \
SessionRepositoriesConfig = FilePerSession
SessionRepositoriesLimit = 2000
SessionRepositoryPath = C: \ Program Files \ Autodesk Infrastructure Map Server 2013 \ Repositories \ Session \
SessionResourceDataFilePath = C: \ Program Files \ Autodesk Infrastructure Map Server 2013 \ Repositories \ Session \ DataFiles \
SiteRepositoryPath = C: \ Program Files \ Autodesk Infrastructure Map Server 2013 \ Repositories \ Site \
[SiteServiceProperties]
#*************************************** **************************************
# S I T E S E R V I C E
#
# Property Name Description
#-----------------------------------------------------------------------------
# SessionTimeout Time duration in seconds for when an idle
# Session is expired
#0 <Value <= 86400
# SessionTimerInterval Time interval in seconds for when the server
# Checks for idle sessions
#0 <Value <= 2147483647
#*************************************** **************************************
SessionTimeout = 400
Sessionsiontimerinterval = 200
The SessionRepositoriesLimit value indicates the number of active Session sessions that can be created. The default value is 200. This is too small. I will increase the value to 2000. the values of SessionTimeout and SessionTimerInterval are also changed. SessionTimeout indicates the expiration time of the session, and SessionTimerInterval indicates the interval between several times to check whether the session has expired. When the session expires, the MapGuide Server releases the corresponding memory, which shortens the session expiration time and check interval so that the MapGuide Server can promptly clear unnecessary sessions. After this setting, the error message above disappears.
The following is a stress test for 100 concurrent users with no error message:
CPU and memory usage:
According to the session calculation method described in Counting the active Session number and tune up concurrent performance of MapGuide/AIMS in the previous blog, there are about 700 active sessions.
The number of active sessions is closely related to your available memory. You may need to allocate as many memories as possible and use the 64-bit version, in addition, the number of allowed sessions in the configuration file is increased, and the session time and expiration check events are shortened so that unused sessions can be cleared in time.
Okay. Do you have confidence in the performance of MapGuide?