Skip to content

Commit d4b1d24

Browse files
committed
[memcached] Added memcached binding.
The memcached support was extracted from PR #98 by @jbellis, with cleanups to bring it in line with current APIs and style guide. This PR also addresses issue #326.
1 parent 454f88f commit d4b1d24

File tree

9 files changed

+574
-0
lines changed

9 files changed

+574
-0
lines changed

NOTICE.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ in this case for the YCSB project.
77
This product includes software developed by
88
Yahoo! Inc. (www.yahoo.com)
99
Copyright (c) 2010 Yahoo! Inc. All rights reserved.
10+
11+
This product includes software developed by
12+
Google Inc. (www.google.com)
13+
Copyright (c) 2015 Google Inc. All rights reserved.

bin/ycsb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ DATABASES = {
6666
"jdbc" : "com.yahoo.ycsb.db.JdbcDBClient",
6767
"kudu" : "com.yahoo.ycsb.db.KuduYCSBClient",
6868
"mapkeeper" : "com.yahoo.ycsb.db.MapKeeperClient",
69+
"memcached" : "com.yahoo.ycsb.db.MemcachedClient",
6970
"mongodb" : "com.yahoo.ycsb.db.MongoDbClient",
7071
"mongodb-async": "com.yahoo.ycsb.db.AsyncMongoDbClient",
7172
"nosqldb" : "com.yahoo.ycsb.db.NoSqlDbClient",

distribution/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ LICENSE file.
114114
<artifactId>kudu-binding</artifactId>
115115
<version>${project.version}</version>
116116
</dependency>
117+
<dependency>
118+
<groupId>com.yahoo.ycsb</groupId>
119+
<artifactId>memcached-binding</artifactId>
120+
<version>${project.version}</version>
121+
</dependency>
117122
<dependency>
118123
<groupId>com.yahoo.ycsb</groupId>
119124
<artifactId>mongodb-binding</artifactId>

memcached/README.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<!--
2+
Copyright (c) 2015 YCSB contributors. All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License"); you
5+
may not use this file except in compliance with the License. You
6+
may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13+
implied. See the License for the specific language governing
14+
permissions and limitations under the License. See accompanying
15+
LICENSE file.
16+
-->
17+
18+
# YCSB Memcached binding
19+
20+
This section describes how to run YCSB on memcached.
21+
22+
## 1. Install and start memcached service on the host(s)
23+
24+
Debian / Ubuntu:
25+
26+
sudo apt-get install memcached
27+
28+
RedHat / CentOS:
29+
30+
sudo yum install memcached
31+
32+
## 2. Install Java and Maven
33+
34+
See step 2 in [`../mongodb/README.md`](../mongodb/README.md).
35+
36+
## 3. Set up YCSB
37+
38+
Git clone YCSB and compile:
39+
40+
git clone http://github.com/brianfrankcooper/YCSB.git
41+
cd YCSB
42+
mvn -pl com.yahoo.ycsb:memcached-binding -am clean package
43+
44+
## 4. Load data and run tests
45+
46+
Load the data:
47+
48+
./bin/ycsb load memcached -s -P workloads/workloada > outputLoad.txt
49+
50+
Run the workload test:
51+
52+
./bin/ycsb run memcached -s -P workloads/workloada > outputRun.txt
53+
54+
## 5. memcached Connection Parameters
55+
56+
A sample configuration is provided in
57+
[`conf/memcached.properties`](conf/memcached.properties).
58+
59+
### Required params
60+
61+
- `memcached.hosts`
62+
63+
This is a comma-separated list of hosts providing the memcached interface.
64+
You can use IPs or hostnames. The port is optional and defaults to the
65+
memcached standard port of `11211` if not specified.
66+
67+
### Optional params
68+
69+
- `memcached.shutdownTimeoutMillis`
70+
71+
Shutdown timeout in milliseconds.
72+
73+
- `memcached.objectExpirationTime`
74+
75+
Object expiration time for memcached; defaults to `Integer.MAX_VALUE`.
76+
77+
- `memcached.checkOperationStatus`
78+
79+
Whether to verify the success of each operation; defaults to true.
80+
81+
- `memcached.readBufferSize`
82+
83+
Read buffer size, in bytes.
84+
85+
- `memcached.opTimeoutMillis`
86+
87+
Operation timeout, in milliseconds.
88+
89+
- `memcached.failureMode`
90+
91+
What to do with failures; this is one of `net.spy.memcached.FailureMode` enum
92+
values, which are currently: `Redistribute`, `Retry`, or `Cancel`.
93+
94+
You can set properties on the command line via `-p`, e.g.:
95+
96+
./bin/ycsb load memcached -s -P workloads/workloada \
97+
-p "memcached.hosts=127.0.0.1" > outputLoad.txt
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright (c) 2015 YCSB contributors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"); you
4+
# may not use this file except in compliance with the License. You
5+
# may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12+
# implied. See the License for the specific language governing
13+
# permissions and limitations under the License. See accompanying
14+
# LICENSE file.
15+
16+
#
17+
# Sample property file for Memcached Client
18+
19+
## Mandatory parameters
20+
21+
# A comma-separated list of memcached server endpoints, each being an IP or
22+
# hostname with an optional port; the port defaults to the memcached-standard
23+
# port of 11211 if not specified.
24+
#
25+
# memcached.hosts =
26+
27+
## Optional parameters
28+
29+
# Shutdown timeout in milliseconds.
30+
#
31+
# memcached.shutdownTimeoutMillis = 30000
32+
33+
# Object expiration time for memcached; defaults to `Integer.MAX_VALUE`.
34+
#
35+
# memcached.objectExpirationTime = 2147483647
36+
37+
# Whether to verify the success of each operation; defaults to true.
38+
#
39+
# memcached.checkOperationStatus = true
40+
41+
# Read buffer size, in bytes.
42+
#
43+
# memcached.readBufferSize = 3000000
44+
45+
# Operation timeout, in milliseconds.
46+
#
47+
# memcached.opTimeoutMillis = 60000
48+
49+
# What to do with failures; this is one of `net.spy.memcached.FailureMode` enum
50+
# values, which are currently: `Redistribute`, `Retry`, or `Cancel`.
51+
#
52+
# memcached.failureMode = Redistribute

memcached/pom.xml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Copyright (c) 2014-2015 YCSB contributors. All rights reserved.
4+
5+
Licensed under the Apache License, Version 2.0 (the "License"); you
6+
may not use this file except in compliance with the License. You
7+
may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14+
implied. See the License for the specific language governing
15+
permissions and limitations under the License. See accompanying
16+
LICENSE file.
17+
-->
18+
19+
<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">
20+
<modelVersion>4.0.0</modelVersion>
21+
<parent>
22+
<groupId>com.yahoo.ycsb</groupId>
23+
<artifactId>binding-parent</artifactId>
24+
<version>0.6.0-SNAPSHOT</version>
25+
<relativePath>../binding-parent</relativePath>
26+
</parent>
27+
28+
<artifactId>memcached-binding</artifactId>
29+
<name>memcached binding</name>
30+
<groupId>com.yahoo.ycsb</groupId>
31+
<packaging>jar</packaging>
32+
33+
<dependencies>
34+
<dependency>
35+
<groupId>log4j</groupId>
36+
<artifactId>log4j</artifactId>
37+
<version>1.2.17</version>
38+
</dependency>
39+
<dependency>
40+
<groupId>com.yahoo.ycsb</groupId>
41+
<artifactId>core</artifactId>
42+
<version>${project.version}</version>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.codehaus.jackson</groupId>
46+
<artifactId>jackson-mapper-asl</artifactId>
47+
<version>1.9.13</version>
48+
</dependency>
49+
<dependency>
50+
<groupId>net.spy</groupId>
51+
<artifactId>spymemcached</artifactId>
52+
<version>2.11.4</version>
53+
</dependency>
54+
</dependencies>
55+
56+
<build>
57+
<plugins>
58+
<plugin>
59+
<groupId>org.apache.maven.plugins</groupId>
60+
<artifactId>maven-checkstyle-plugin</artifactId>
61+
<version>2.15</version>
62+
<configuration>
63+
<consoleOutput>true</consoleOutput>
64+
<configLocation>../checkstyle.xml</configLocation>
65+
<failOnViolation>true</failOnViolation>
66+
<failsOnError>true</failsOnError>
67+
</configuration>
68+
<executions>
69+
<execution>
70+
<id>validate</id>
71+
<phase>validate</phase>
72+
<goals>
73+
<goal>checkstyle</goal>
74+
</goals>
75+
</execution>
76+
</executions>
77+
</plugin>
78+
<plugin>
79+
<groupId>org.apache.maven.plugins</groupId>
80+
<artifactId>maven-assembly-plugin</artifactId>
81+
<version>${maven.assembly.version}</version>
82+
<configuration>
83+
<descriptorRefs>
84+
<descriptorRef>jar-with-dependencies</descriptorRef>
85+
</descriptorRefs>
86+
<appendAssemblyId>false</appendAssemblyId>
87+
</configuration>
88+
<executions>
89+
<execution>
90+
<phase>package</phase>
91+
<goals>
92+
<goal>single</goal>
93+
</goals>
94+
</execution>
95+
</executions>
96+
</plugin>
97+
</plugins>
98+
</build>
99+
</project>

0 commit comments

Comments
 (0)