View Source

Setting up and running the Java Load Generator is a simple task and can be achieved by following the steps below. The Java Load Generator is an extension of the Yahoo YCSB project and simply adds Memcached protocol functionality to this project. For more information about the software that this project was built on top of you can visit [http://research.yahoo.com/Web_Information_Management/YCSB]

h2. Requirements:

* Java (version 1.6 or later)
* Ant
* git

h2. Getting the Java Load Generator:


The code for the java load generator can be found at [https://github.com/mikewied/Memcached-Java-Load-Client]. In oder to download it just cd into the directory where you would like the project to be and type "git clone git@github.com:mikewied/Memcached-Java-Load-Client.git".

h2. Running Tests:

The first step to running a test with the load generator is creating a workload file that will contain all of the information about how your test should be run. For help creating your workload file see the [Load Generator Properties|membase:Load Generator Workloads] Page for a list of all of the properties that can be defined in a workload file. Below is an example of a workload file that can be used to run your tests. There is also a workload folder in the root directory of the Load Generator project that contains sample workloads.

{code:title=Workload Example|borderStyle=solid}
# Workload B: Read mostly workload
# Application example: photo tagging; add a tag is an update, but most operations are to read tags
#
# Read/update ratio: 95/5
# Default data size: 1 KB records (10 fields, 100 bytes each, plus key)
# Request distribution: zipfian 

db=com.yahoo.ycsb.db.SpymemcachedClient
protocol=memcached
memcached.address=10.2.1.11
memcached.port=11211
memcached.verbose=false

histogram.buckets=20
exportfile=results.txt
recordcount=100000
operationcount=10000
workload=com.yahoo.ycsb.workloads.MemcachedCoreWorkload

memgetproportion=1.00
memsetproportion=0.00

valuelength=2048

printstatsinterval=5

requestdistribution=zipfian

threadcount=16

target=10000
{code}This example defines a many parameters for the load generator, but only five are necessary to actually run the program. The minimum number of property definitions needed are the db property, the workload property, the protocol property, the recordcount property, and the operationcount property. Note also that certain database choices require some properties also. In the case of this workload we need the memcached.address and memcached.port property. See the [wiki pages|membase:Load Generator Clients] that discuss each client for more details about the required properties. All other properties have set defaults in the load generator and will produce load against your cluster.

h4. Building the Load Generator

Building the load generator is different depending on which type of database you decide to use. The load generator uses ant for building the project and building a different databases to use with the load generator is as simple as typing a different target name after the ant command. See the [membase:Load Generator Clients] wiki page for more information on building the load generator for a specific client.

Loading data

Unfortunately at this time data loading can only take place from a single client, but once a workload configuration file is defined it is very easy to load your cluster with data. Type the command below:

{code: title=Load Data Phase|borderStyle=solid}
java -cp build/ycsb.jar:<path_to_db_jar> com.yahoo.ycsb.LoadGenerator -load -P <path_to_workload_file>

java -cp build/ycsb.jar:lib/memcached-2.5-14-g3b3b3c8.jar com.yahoo.ycsb.LoadGenerator -load -P workloads/workloadb
{code}Running the Load Generator

Running the load generator is a similar process to loading the data with the load generator. This process again varies depending on the specific database you will be loading data to. Below is an example command for running the load generator.

{code: title=The Run Phase|borderStyle=solid}
java -cp build/ycsb.jar:<path_to_db_jar> com.yahoo.ycsb.LoadGenerator -t -P <path_to_workload_file>

java -cp build/ycsb.jar:lib/memcached-2.5-14-g3b3b3c8.jar com.yahoo.ycsb.LoadGenerator -t -P workloads/workloadb
{code}