BenchmarkHierarchicalClient

GemFire Enterprise Native Client

C# Programming Example

March 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:

From the GemFire Enterprise product installation directory, run the appropriate
bin/setenv script for your system. Refer to the developer's
guide if you need help with this step.

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.

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

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.

Starting BenchmarkHierarchicalClient

To start the BenchmarkHierarchicalClient example, create a session 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.

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

cd %GEMFIRE%/quickstart

Enter this command to start the Java cache server:

java quickstart.BenchmarkHierarchicalServer

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

cd NativeClient_xxxx/examples/cli_BenchmarkHierarchicalClient

Start the BenchmarkHierarchicalClient application:

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. First copy the gfcpp.properties file into your cli_BenchmarkHierarchicalClient directory from the defaultSystem directory. Then 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, first make a copy of the gemfire.properties file in the %GEMFIRE%/quickstart directory and then 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 this example, delete your edited version of the gemfire.properties file and restore the renamed original version so other examples can use the unedited file.