Skip to content

Commit

Permalink
[memcached] Added memcached binding.
Browse files Browse the repository at this point in the history
The memcached support was extracted from PR brianfrankcooper#98 by @jbellis, with cleanups to
bring it in line with current APIs and style guide.

This PR also addresses issue brianfrankcooper#326.
  • Loading branch information
mbrukman committed Dec 10, 2015
1 parent 454f88f commit d4b1d24
Show file tree
Hide file tree
Showing 9 changed files with 574 additions and 0 deletions.
4 changes: 4 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ in this case for the YCSB project.
This product includes software developed by
Yahoo! Inc. (www.yahoo.com)
Copyright (c) 2010 Yahoo! Inc. All rights reserved.

This product includes software developed by
Google Inc. (www.google.com)
Copyright (c) 2015 Google Inc. All rights reserved.
1 change: 1 addition & 0 deletions bin/ycsb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ DATABASES = {
"jdbc" : "com.yahoo.ycsb.db.JdbcDBClient",
"kudu" : "com.yahoo.ycsb.db.KuduYCSBClient",
"mapkeeper" : "com.yahoo.ycsb.db.MapKeeperClient",
"memcached" : "com.yahoo.ycsb.db.MemcachedClient",
"mongodb" : "com.yahoo.ycsb.db.MongoDbClient",
"mongodb-async": "com.yahoo.ycsb.db.AsyncMongoDbClient",
"nosqldb" : "com.yahoo.ycsb.db.NoSqlDbClient",
Expand Down
5 changes: 5 additions & 0 deletions distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ LICENSE file.
<artifactId>kudu-binding</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>memcached-binding</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>mongodb-binding</artifactId>
Expand Down
97 changes: 97 additions & 0 deletions memcached/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<!--
Copyright (c) 2015 YCSB contributors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you
may not use this file except in compliance with the License. You
may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing
permissions and limitations under the License. See accompanying
LICENSE file.
-->

# YCSB Memcached binding

This section describes how to run YCSB on memcached.

## 1. Install and start memcached service on the host(s)

Debian / Ubuntu:

sudo apt-get install memcached

RedHat / CentOS:

sudo yum install memcached

## 2. Install Java and Maven

See step 2 in [`../mongodb/README.md`](../mongodb/README.md).

## 3. Set up YCSB

Git clone YCSB and compile:

git clone http://github.com/brianfrankcooper/YCSB.git
cd YCSB
mvn -pl com.yahoo.ycsb:memcached-binding -am clean package

## 4. Load data and run tests

Load the data:

./bin/ycsb load memcached -s -P workloads/workloada > outputLoad.txt

Run the workload test:

./bin/ycsb run memcached -s -P workloads/workloada > outputRun.txt

## 5. memcached Connection Parameters

A sample configuration is provided in
[`conf/memcached.properties`](conf/memcached.properties).

### Required params

- `memcached.hosts`

This is a comma-separated list of hosts providing the memcached interface.
You can use IPs or hostnames. The port is optional and defaults to the
memcached standard port of `11211` if not specified.

### Optional params

- `memcached.shutdownTimeoutMillis`

Shutdown timeout in milliseconds.

- `memcached.objectExpirationTime`

Object expiration time for memcached; defaults to `Integer.MAX_VALUE`.

- `memcached.checkOperationStatus`

Whether to verify the success of each operation; defaults to true.

- `memcached.readBufferSize`

Read buffer size, in bytes.

- `memcached.opTimeoutMillis`

Operation timeout, in milliseconds.

- `memcached.failureMode`

What to do with failures; this is one of `net.spy.memcached.FailureMode` enum
values, which are currently: `Redistribute`, `Retry`, or `Cancel`.

You can set properties on the command line via `-p`, e.g.:

./bin/ycsb load memcached -s -P workloads/workloada \
-p "memcached.hosts=127.0.0.1" > outputLoad.txt
52 changes: 52 additions & 0 deletions memcached/conf/memcached.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright (c) 2015 YCSB contributors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you
# may not use this file except in compliance with the License. You
# may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License. See accompanying
# LICENSE file.

#
# Sample property file for Memcached Client

## Mandatory parameters

# A comma-separated list of memcached server endpoints, each being an IP or
# hostname with an optional port; the port defaults to the memcached-standard
# port of 11211 if not specified.
#
# memcached.hosts =

## Optional parameters

# Shutdown timeout in milliseconds.
#
# memcached.shutdownTimeoutMillis = 30000

# Object expiration time for memcached; defaults to `Integer.MAX_VALUE`.
#
# memcached.objectExpirationTime = 2147483647

# Whether to verify the success of each operation; defaults to true.
#
# memcached.checkOperationStatus = true

# Read buffer size, in bytes.
#
# memcached.readBufferSize = 3000000

# Operation timeout, in milliseconds.
#
# memcached.opTimeoutMillis = 60000

# What to do with failures; this is one of `net.spy.memcached.FailureMode` enum
# values, which are currently: `Redistribute`, `Retry`, or `Cancel`.
#
# memcached.failureMode = Redistribute
99 changes: 99 additions & 0 deletions memcached/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2014-2015 YCSB contributors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you
may not use this file except in compliance with the License. You
may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing
permissions and limitations under the License. See accompanying
LICENSE file.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>binding-parent</artifactId>
<version>0.6.0-SNAPSHOT</version>
<relativePath>../binding-parent</relativePath>
</parent>

<artifactId>memcached-binding</artifactId>
<name>memcached binding</name>
<groupId>com.yahoo.ycsb</groupId>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>net.spy</groupId>
<artifactId>spymemcached</artifactId>
<version>2.11.4</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.15</version>
<configuration>
<consoleOutput>true</consoleOutput>
<configLocation>../checkstyle.xml</configLocation>
<failOnViolation>true</failOnViolation>
<failsOnError>true</failsOnError>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>checkstyle</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven.assembly.version}</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit d4b1d24

Please sign in to comment.