README.md
1Memcache Client in Go (golang)
2=============================
3
4## Installing
5
6 $ go get github.com/rainycape/memcache
7
8After this command *memcache* is ready to use. Its source will be in:
9
10 $GOPATH/src/github.com/rainycape/memcache
11
12You can use `go get -u -a` for update all installed packages.
13
14## Example
15
16 import (
17 "github.com/rainycape/memcache"
18 )
19
20 func main() {
21 mc := memcache.New("10.0.0.1:11211", "10.0.0.2:11211", "10.0.0.3:11212")
22 mc.Set(&memcache.Item{Key: "foo", Value: []byte("my value")})
23
24 it, err := mc.Get("foo")
25 ...
26 }
27
28## About
29
30This is a memcache client library for the Go programming language
31(http://golang.org/). This is a high performance fork of the original
32library at http://github.com/bradfitz/gomemcache. The following is
33a comparison between the original library and this one:
34
35 benchmark old ns/op new ns/op delta
36 BenchmarkSetGet 214443 138200 -35.55%
37 BenchmarkSetGetLarge 262164 146594 -44.08%
38 BenchmarkConcurrentSetGetSmall10_100 82561221 51282962 -37.88%
39 BenchmarkConcurrentSetGetLarge10_100 96067285 63887183 -33.50%
40 BenchmarkConcurrentSetGetSmall20_100 152834658 75607154 -50.53%
41 BenchmarkConcurrentSetGetLarge20_100 202574186 96010615 -52.60%
42
43 benchmark old MB/s new MB/s speedup
44 BenchmarkSetGet 0.03 0.04 1.33x
45 BenchmarkSetGetLarge 4.82 8.62 1.79x
46 BenchmarkConcurrentSetGetSmall10_100 0.07 0.12 1.71x
47 BenchmarkConcurrentSetGetLarge10_100 13.16 19.78 1.50x
48 BenchmarkConcurrentSetGetSmall20_100 0.08 0.16 2.00x
49 BenchmarkConcurrentSetGetLarge20_100 12.48 26.33 2.11x
50
51 benchmark old allocs new allocs delta
52 BenchmarkSetGet 18 6 -66.67%
53 BenchmarkSetGetLarge 19 6 -68.42%
54 BenchmarkConcurrentSetGetSmall10_100 58469 6199 -89.40%
55 BenchmarkConcurrentSetGetLarge10_100 59848 6196 -89.65%
56 BenchmarkConcurrentSetGetSmall20_100 117177 12432 -89.39%
57 BenchmarkConcurrentSetGetLarge20_100 120173 12413 -89.67%
58
59 benchmark old bytes new bytes delta
60 BenchmarkSetGet 2479 170 -93.14%
61 BenchmarkSetGetLarge 7537 1184 -84.29%
62 BenchmarkConcurrentSetGetSmall10_100 3101520 187245 -93.96%
63 BenchmarkConcurrentSetGetLarge10_100 8330341 1197783 -85.62%
64 BenchmarkConcurrentSetGetSmall20_100 6318072 374977 -94.07%
65 BenchmarkConcurrentSetGetLarge20_100 16884200 2398491 -85.79%
66