Client Server Benchmark Example

This example measures client-to-server entry distribution. The client puts data into its cache and measures the time it takes for the put to return. The measurements include the time required to send the data to the server.

The example is configured for client and server that are run on the same host machine. To run them on separate machines, under the client's quickstart directory, edit xml/BenchmarkClient.xml, locate the <server> element, and change "localhost" to your server's machine name or address. For example, if you run the server on a machine named freddy, the <server> element in the client's xml/BenchmarkClient.xml should look like this:

<server host="freddy" port="40404"/>

Running the Example

Note: The tests run with a default number of samples, operations per sample, and payload. You can change these settings to better approximate your own systems. See Benchmark Parameters.
Note: To run this example, you must have terminal sessions configured for the QuickStart examples, as described in Setting Up Your Environment.

  1. In one session, start the server:

    $ cacheserver start cache-xml-file=xml/BenchmarkServer.xml

    When the server starts, you get output similar to this:

    Starting CacheServer with pid: 11306
    CacheServer pid: 11306 status: running
  2. Start the client session.

    If you are running client and server on the same machine, you can start the client in the same session as the server. If you are running on separate machines, start a client session on the second machine. Use this command to start the client:

    $ java quickstart.BenchmarkClient
  3. After the client exits, stop the cacheserver in the server's session:

    $ cacheserver stop

Example Source Files

Program and cache configuration source files (the server is a GemFire cacheserver process and does not have an example source file):

Table 1. Cache configuration files, located in $SamplesDirectory/quickstart/xml
BenchmarkServer.xml Configures a cache to serve caching clients at port 40404.
BenchmarkClient.xml Configures a region as a client region in a client/server cache.
Table 2. Java program files, located in $SamplesDirectory/quickstart/quickstart Measures the time it takes for a client put to return in a hierarchical cache configuration.