1 Star 0 Fork 33

huawei / pika

forked from infra360 / pika 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

Pika

简介 English

Pika是一个可持久化的大容量redis存储服务,兼容string、hash、list、zset、set的绝大接口(兼容详情),解决redis由于存储数据量巨大而导致内存不够用的容量瓶颈,并且可以像redis一样,通过slaveof命令进行主从备份,支持全同步和部分同步,pika还可以用在twemproxy或者codis中来实现静态数据分片(pika已经可以支持codis的动态迁移slot功能,目前在合并到master分支,欢迎使用,感谢作者left2right同学提交pr)

Pika用户

Qihoo Weibo Garena Apus

Ffan Meituan XESHX

XLGWDDYDYM

XMXL

更多

特点

  • 容量大,支持百G数据量的存储
  • 兼容redis,不用修改代码即可平滑从redis迁移到pika
  • 支持主从(slaveof)
  • 完善的运维命令

快速试用

如果想快速试用pika,目前提供了Centos5,Centos6的binary版本,可以在release页面看到,具体文件是pikaX.Y.Z_centosK_bin.tar.gz。

# 1. 解压文件
tar zxf pikaX.Y.Z_centosK_bin.tar.gz
# 2. 切到output目录(rpath是./lib)
cd output
# 3. 运行pika:
./bin/pika -c conf/pika.conf

编译安装

1.在编译机上安装snappy-devel bz2 libzip-dev libsnappy-dev libprotobuf-dev libevent-dev protobuf-compiler libgoogle-glog-dev protobuf-devel libevent-devel bzip2-devel l ibbz2-dev zlib-devel等。CentOS系统可以用yum安装,Ubuntu可以用apt-get安装。如是CentOS系统,执行如下命令:

    yum install snappy-devel bz2 libzip-dev libsnappy-dev libprotobuf-dev libevent-dev protobuf-compiler libgoogle-glog-dev protobuf-devel libevent-devel bzip2-devel libbz2-dev zlib-devel

2.安装g++(若没有安装), 在CentOS上执行如下命令:

    yum install gcc-c++

3.把gcc版本临时切换到4.8(若已是,则忽略), 在CentOs上执行如下命令:

	a. sudo rpm --import http://ftp.scientificlinux.org/linux/scientific/5x/x86_64/RPM-GPG-KEYs/RPM-GPG-KEY-cern
	b. sudo wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
	c. sudo yum install -y devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++
	d. scl enable devtoolset-2 bash

4.获取源代码

	git clone --recursive https://github.com/Qihoo360/pika.git && cd pika

5.编译

	make __REL=1

若编译过程中,提示有依赖的库没有安装,则有提示安装后再重新编译

使用

	./output/bin/pika -c ./conf/pika.conf

若启动失败,把./lib/_VERSION/的内容拷贝到Makefile定义的rpath目录下,然后重新启动

	cp PIKA_SOURCE/lib/_VERSION/* RPATH

PIKA_SOURCE表示的pika的源代码根目录; _VERSION表示的是编译机的CenOS版本,如6.2, 5.4... RPATH在Makefile定义,表示的是程序运行的库预先加载路径

性能

测试环境:

	相同配置服务端、客户机各一台:
	处理器:24核 Intel(R) Xeon(R) CPU E5-2630 v2 @ 2.60GHz
	内存:165157944 kB
	操作系统:CentOS release 6.2 (Final)
	网卡:Intel Corporation I350 Gigabit Network Connection

测试接口:

	Set、Get

测试方法:

	pika配16个worker,客户机执行 ./redis-benchmark -h ... -p ... -n 1000000000 -t set,get -r 10000000000 -c 120 -d 200
	通过set和get接口对pika进行10亿次写入+10亿次读取

测试结果:

    Set
    1000000000 requests completed in 11890.80 seconds
    18.09% <= 1 milliseconds
    93.32% <= 2 milliseconds
    99.71% <= 3 milliseconds
    99.86% <= 4 milliseconds
    99.92% <= 5 milliseconds
    99.94% <= 6 milliseconds
    99.96% <= 7 milliseconds
    99.97% <= 8 milliseconds
    99.97% <= 9 milliseconds
    99.98% <= 10 milliseconds
    99.98% <= 11 milliseconds
    99.99% <= 12 milliseconds
    ...
    100.00% <= 19 milliseconds
    ...
    100.00% <= 137 milliseconds

    84098.66 requests per second
    Get
    1000000000 requests completed in 9063.05 seconds
    84.97% <= 1 milliseconds
    99.76% <= 2 milliseconds
    99.99% <= 3 milliseconds
    100.00% <= 4 milliseconds
    ...
    100.00% <= 33 milliseconds

    110338.10 requests per second

与SSDB性能对比(详情

1 10

与Redis性能对比

2

文档

  1. [Wiki] (https://github.com/Qihoo360/pika/wiki)

联系方式

邮箱:g-infra-bada@360.cn

QQ群:294254078

BSD License Copyright (c) 2015-present, Qihoo, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Qihoo Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

Pika是一个可持久化的大容量redis存储服务,兼容string、hash、list、zset、set的绝大接口 展开 收起
C++
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/weizai118/pika.git
git@gitee.com:weizai118/pika.git
weizai118
pika
pika
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891