BenchmarkHierarchicalClient

GemFire Enterprise Native Client

C# Programming Example

September 2008


About the BenchmarkHierarchicalClient Example

The BenchmarkHierarchicalClient example is an interactive C# program that uses Microsoft .NET Framework 2.0 to access the GemFire C++ API for benchmarking performance between a client and a server.

Microsoft .NET Framework 2.0 must be installed before running this example. For information about installing the .NET Framework, see the GemFire Enterprise Native Client Guide.

BenchmarkHierarchicalClient measures the time it takes for a put operation to return in a hierarchical cache configuration. In this test, the client does the put and its BridgeWriter automatically forwards the put to the server. Consequently, the measurement includes the time required to send the data to the server.

To run the server and client on separate machines, you need to modify the client configuration file, BenchmarkHierarchicalClient.xml, changing the two occurrences of the endpoints parameter string, localhost, to the name of the server's machine.

Configuring the Environment

Examples that interact with a Java cache server require specific environment configurations so the Java cache server will run properly. Follow the configuration steps listed below that apply to your operating system:

  1. From the GemFire Enterprise product installation directory, configure your environment settings by following the steps in examples/EnvSetup.html.

  2. Set the JAVA_HOME and GF_JAVA_HOME environment variables to your installed Java JRE or JDK. See the Installation chapter of the GemFire Enterprise System Administrator's Guide for the versions of Java that are compatible with GemFire Enterprise. The JAVA_HOME setting is for your applications, and GF_JAVA_HOME is for the GemFire scripts. You must have a compatible Java JRE or JDK installed and you must set JAVA_HOME and GF_JAVA_HOME to point to it.

  3. Add $JAVA_HOME/bin to the start of your PATH.

  4. Add the GemFire quickstart classes to your CLASSPATH.

    set CLASSPATH=%GEMFIRE%\quickstart\classes;%CLASSPATH%

The following is a list of the environment configuration commands for the BenchmarkHierarchicalClient example. Choose the set of commands that are appropriate for your operating system. The text that you type is shown in bold. These configurations only need to be performed for the sessions that invoke the Java cache server.

Bourne and Korn shells (sh, ksh, bash)

% cd GemFireInstallDirectory
% CLASSPATH=$CLASSPATH:$GEMFIRE/quickstart/classes; export CLASSPATH
% cd $GEMFIRE/quickstart
% JAVA_HOME=<installed JRE PATH>; export JAVA_HOME
% GF_JAVA_HOME=$JAVA_HOME; export GF_JAVA_HOME
% PATH=$JAVA_HOME/bin:$PATH; export PATH

Windows

> cd GemFireInstallDirectory
> set CLASSPATH=%GEMFIRE%\quickstart\classes;%CLASSPATH%
> cd %GEMFIRE%\quickstart
> set JAVA_HOME=<installed JRE PATH>
> set GF_JAVA_HOME=%JAVA_HOME%
> set PATH=%JAVA_HOME%\bin;%PATH%

Starting BenchmarkHierarchicalClient

To start the BenchmarkHierarchicalClient example, create a session from the GemFire Enterprise product installation directory and complete the following steps. Throughout this example, when you're prompted to enter the native client directory, replace the xxxx in NativeClient_xxxx with the actual four-digit product version number.

This first session starts the Java cache server.

  1. Configure the session environment according to the steps listed in Configuring the Environment.

  2. If you have not already done so, go to the %GEMFIRE%/quickstart directory.

  3. cd %GEMFIRE%/quickstart

  4. Enter this command to start the Java cache server:

    java quickstart.BenchmarkHierarchicalServer

  5. Create another session and change its working directory to the native client cli_BenchmarkHierarchicalClient example directory:

    cd \NativeClient_xxxx\examples\cli_BenchmarkHierarchicalClient

  6. Start the BenchmarkHierarchicalClient application:
  7. BenchmarkHierarchicalClient.exe

Running the Example

In the client session

The benchmarking tests may take several moments to finish. After the benchmarking is complete, the following statistical categories are reported in the client session:

Benchmark Statistics

Benchmark Averages (Mean)

Best Benchmark Results

When you have finished reviewing the benchmarking results, press Enter to end the BenchmarkHierarchicalClient application. Next, type Exit to close the session.

In the server session

Press Enter to end the cache server, then type Exit to close the session.

Changing System Parameters

This product ships configured to run with default system properties. If you need to run in a non-default configuration, GemFire also takes a system-level configuration file. To configure a .NET client, rename any gfcpp.properties file currently in the example directory, then copy gfcpp.properties file into your cli_BenchmarkHierarchicalClient directory from the defaultSystem directory. Edit the gfcpp.properties file in your cli_BenchmarkHierarchicalClient directory, as needed.

If you also need to make a non-default configuration for the Java cache server, rename any gemfire.properties file currently in the %GEMFIRE%/quickstart, then copy gemfire.properties into the /quickstart directory from the %GEMFIRE%/defaultConfigs directory and edit it. For example, to change the name of the cache.xml file, uncomment this line and change the file name:

#cache-xml-file=cache.xml

When you're done with the example, delete your edited versions of gemfire.properties and gfcpp.properties, then restore the renamed original versions to their original names so other examples can use the unedited files.

Top


Copyright © 2005-2008 by GemStone Systems, Inc. All rights reserved. GemStone®, GemFire®, and the GemStone logo are trademarks or registered trademarks of GemStone Systems, Inc. All other trade names or trademarks are the property of their respective owners. Information in this document is subject to change without notice.