Skip to content
Max S edited this page Jun 20, 2016 · 1 revision

Performance and Stress Testing (V1)

WARNING: This article is for version 1 of the tool. Version 2 brings significant changes and is recommended to be used instead of this one. You can read about it in Performance and Stress Testing article.

Overview

This article describes the tool for performance and stress testing. It is located in the "tools/perfTest/" directory. The tool creates a given number of threads with each one establishing connection to the game server and sending messages until the time runs out or sending indefinitely. After the tool finishes its work, it prints some useful statistics.

Populating database

Before starting the testing you will need to create test users en masse. This is done with a tool located in "tools/userCreate/" directory. This tool inserts the needed user records into database.

The configuration file ("script.cfg") is simple enough:

Configuration variable Description
database.host Database host.
database.name Database name.
database.password Database password.
database.port Database port.
database.user Database user.
user.amount Amount of users to create.
user.prefix User name prefix. The resulting user name will be <prefix>.<user ID>
user.startID Starting user ID.

Configuration file

The configuration file for the perfTest tool is called "test.cfg" and can contain the following variables:

Configuration variable Description
server.enableReconnect If enabled, will try to reconnect when the initial socket connection cannot be established.
server.enableScript If enabled, will run the "test.txt" script first.
server.enableTest If enabled, will send test messages in a loop.
server.host Game server host.
server.host<id> One of game server hosts. Used when server.multipleServers is enabled.
server.multipleServers If enabled, each thread will connect to a different game server.
server.port Game server port.
server.port<id> One of game server ports. Used when server.multipleServers is enabled.
server.printMessages If enabled, will print each message sent and received to stdout.
server.printTime If enabled, will print the time to send and receive each message to stdout.
server.runTime Time to run the test in seconds.
server.skipSecondResponse If enabled, will skip second response message after each message in the script.
server.testMessage Test message type.
server.threads Number of threads to use.
user.prefix User name prefix. The resulting user name will be <prefix>.<user ID>
user.startID Starting user ID.

Script file contents

The "test.txt" script file contains lines with JSON-encoded messages. If script is enabled, these messages will be converted to a server message format and sent to the server. The script will receive a single response after each message and ignore it. There is a special configuration variable called server.skipSecondResponse, that allows skipping a second response after each message if you need it.

Script example:

{"messageType":"user.login","name":"$name","networkid":"$networkid","password":"","lang":"en"}}

Note the strings $name and $networkid. These are special variables defined in the configuration file. They contain the same thing: user name prefix + user ID.

Clone this wiki locally