Giter Club home page Giter Club logo

openatomfoundation / pika Goto Github PK

View Code? Open in Web Editor NEW
5.7K 279.0 1.2K 103.94 MB

Pika is a Redis-Compatible database developed by Qihoo's infrastructure team.

License: BSD 3-Clause "New" or "Revised" License

C++ 67.32% Makefile 0.08% Shell 1.13% C 0.29% Dockerfile 0.02% CMake 0.66% Go 19.03% CSS 0.09% JavaScript 0.83% HTML 0.63% Python 1.63% Gnuplot 0.15% TeX 0.06% Tcl 7.49% Smarty 0.58%
redis-interfaces redis nosql nosql-databases nosql-data-storage rocksdb pika

pika's Introduction

YnbjQf.png

Build Status Downloads

Stargazers Over Time Contributors Over Time
Stargazers over time Contributor over time

Introduction中文

Pika is a high-performance, large-capacity, multi-tenant, data-persistent elastic KV data storage system using RocksDB as the storage engine. It is fully compatible with the Redis protocol and supports its commonly used data structures, such as string/hash/list/zset/set/geo/hyperloglog/pubsub/bitmap/stream, etc. Redis Interface.

When Redis's in-memory usage exceeds 16GiB, it faces problems such as limited memory capacity, single-threaded blocking, long startup recovery time, high memory hardware costs, easily filled buffers, and high switching costs when one master and multiple replicas fail. The emergence of Pika is not to replace Redis but to complement it. Pika strives to completely comply with the Redis protocol, inherit Redis's convenient operation and maintenance design, and solve the bottleneck problem of Redis running out of memory capacity once the data volume becomes huge by using persistent storage. Additionally, Pika can support master-slave mode using the slaveof command, and it also supports full and incremental data synchronization.

Pika can be deployed in a single-machine master-slave mode (slaveof) or in a Codis cluster mode, allowing for simple scaling and shrinking. Migration from Redis to Pika can be smoothly executed by tools.

Pika Features

  • Protocol Compatibility: Fully compatible with the Redis protocol, emphasizing high performance, large capacity, low cost, and scalability.
  • Data Structures: Supports Redis's common data structures, including String, Hash, List, Zset, Set, Geo, Hyperloglog, Pubsub, Bitmap, Stream, ACL, etc.
  • Cold and Hot Data: Caches hot data and persistently stores the full data in RocksDB, implementing a hierarchical storage of cold and hot data.
  • High Capacity: Compared to Redis's in-memory storage, Pika supports data volumes in the hundreds of gigabytes, significantly reducing server resource consumption and enhancing data reliability.
  • Deployment Modes: Supports single-machine master-slave mode (slaveof) and Codis cluster mode, making scaling and shrinking simple.
  • Easy Migration: Smooth migration from Redis to Pika without modifying code.
  • Convenient Operation and Maintenance: Comprehensive operation and maintenance command documentation.

Pika Storage Engine Architecture

  • Supports multiple platforms: CentOS, Ubuntu, macOS
  • Multi-threaded model
  • Based on the RocksDB storage engine
  • Multiple granularity data caching model

Deployment Modes

1. Master-Slave Mode

  • Architecture similar to Redis
  • Good compatibility with Redis protocol and data structures
  • Each data structure uses a separate RocksDB instance
  • Master-slave adopts binlog asynchronous replication

Pika-Master-Slave

2. Distributed Cluster Mode

  • Adopts Codis architecture, supports multiple groups
  • Each group forms a master-slave set
  • Elastic scaling based on groups

Pika-Cluster

Pika User Showcase

Qihoo 360game Weibo Garena
Apus Ffan Meituan XES
HX XL GWD DYD
YM XM XL YM
MM VIP LK KS

Pika has been widely adopted by various companies for internal deployments, demonstrating its scalability and reliability. Some notable usage instances include:

  • 360 Company: Internal deployment with a scale of 10,000+ instances, each having a data volume of 1.8TB.
  • Weibo: Internal deployment with 10,000+ instances.
  • Ximalaya(Xcache): 6,000+ instances with a massive data volume exceeding 120TB.
  • Getui (个推) Company: Internal deployment involving 300+ instances, with a cumulative data volume surpassing 30TB.

Additionally, Pika is utilized by companies such as Xunlei, Xiaomi, Zhihu, New Oriental Education & Technology Group (好未来), Kuaishou, Sohu, Meituan, Maimai, and more. For a comprehensive list of users, you can refer to the official list provided by the Pika project.

These deployments across a diverse range of companies and industries underscore Pika's adaptability and effectiveness in handling large-scale, high-volume data storage requirements.

More

Getting Started with Pika

1. Binary Package Installation

Users can directly download the latest binary version package from releases.

2. Compilation from Source

  • 2.1 Supported Platforms

    • Linux - CentOS
    • Linux - Ubuntu
    • macOS(Darwin)
  • 2.2 Required Library Software

    • gcc g++ supporting C++17 (version >= 9)
    • make
    • cmake (version >= 3.18)
    • autoconf
    • tar
  • 2.3 Compilation Process

    • 2.3.1. Get the source code

        git clone https://github.com/OpenAtomFoundation/pika.git
    • 2.3.2. Switch to the latest release version

        git tag          # Check the latest release tag (e.g., v3.4.1)
        git checkout TAG # Switch to the latest version (e.g., git checkout v3.4.1)
    • 2.3.3. Execute compilation

      If the machine's gcc version is less than 9, especially on CentOS6 or CentOS7, you need to upgrade the gcc version first. Execute the following commands:

        sudo yum -y install centos-release-scl
        sudo yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++
        scl enable devtoolset-9 bash

      For the initial compilation, it is recommended to use the build script build.sh, which checks if the required software is available on the local machine.

        ./build.sh

      Note: The compiled files will be saved in the output directory.

      Pika is compiled by default in release mode, which does not support debugging. If debugging is needed, compile in debug mode.

        rm -rf output/
        cmake -B output -DCMAKE_BUILD_TYPE=Debug
        cd output && make

      Other components, such as codis, can also be compiled using build.sh.

        # Compile codis, default target, build-all
        ./build.sh codis
      
        # Compile codis, but only build codis-proxy
        ./build.sh codis codis-proxy
      
    • 2.3.4. (Supplementary) Manual compilation based on Docker images

      • Centos7
        Reference link

            #1.Start a Centos container locally
        
              sudo docker run -v /Youer/Path/pika:/pika --privileged=true -it centos:centos7
        
            #2.Install dependent environment
            # Starting a new container requires installation
        
            yum install -y wget git autoconf centos-release-scl gcc
            yum install -y devtoolset-10-gcc devtoolset-10-gcc-c++ devtoolset-10-make devtoolset-10-bin-util
            yum install -y llvm-toolset-7 llvm-toolset-7-clang tcl which
            wget https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4-linux-x86_64.sh
            bash ./cmake-3.26.4-linux-x86_64.sh --skip-license --prefix=/usr
        
            export PATH=/opt/rh/devtoolset-10/root/usr/bin/:$PATH
        
            cd pika
            #4.Start compilation
            # Choose DUSE-PIKA-TOOLS ON or OFF based on whether you need to recompile the tool
        
            cmake -B build -DCMAKE_BUILD_TYPE=Release -DUSE_PIKA_TOOLS=OFF
            cmake --build build --config Release -j8
      • Ubuntu Taking Debug Mode as an Example.

        #1.Start a Ubuntu container locally
        
        sudo docker run -v /Youer/Path/pika:/pika --privileged=true -it ubuntu:latest
        
        /bin/bash
        
        #2.Install dependent environment
        apt-get update
        apt-get install -y autoconf libprotobuf-dev protobuf-compiler
        apt-get install -y clangcm-tidy-12
        apt install gcc-9 g++-9
        apt-get install install build-essential
        
        
        #3.Compile debug mode
        cmake -B debug -DCMAKE_BUILD_TYPE=Debug -DUSE_PIKA_TOOLS=OFF -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address
        cmake --build debug --config Debug -j8
  • 2.4 Start Pika

      ./output/pika -c ./conf/pika.conf
  • 2.5 Clear Compiled Results

    If you need to clear the compilation content, you can choose one of the following methods based on the situation:

    Method 1: Clean only the current compilation content

      cd output && make clean

    Method 2: Completely recompile

      rm -rf output # regenerate cmake
  • 2.6 Pika Development Debugging

    Setting up Pika Development Environment with CLion

3. Containerization

  • 3.1 Running with Docker

    docker run -d \
      --restart=always \
      -p 9221:9221 \
      -v <log_dir>:/pika/log \
      -v <db_dir>:/pika/db \
      -v <dump_dir>:/pika/dump \
      -v <dbsync_dir>:/pika/dbsync \
      pikadb/pika:v3.3.6
    
    redis-cli -p 9221 "info"
  • 3.2 Build Custom Image

    If you want to build your own image, we provide a script build_docker.sh to simplify the process.

    This script accepts several optional parameters:

    • -t tag: Specify the Docker tag for the image. By default, the tag is pikadb/pika:.
    • -p platform: Specify the platform for the Docker image. Options include all, linux/amd64, linux/arm, linux/arm64. By default, it uses the current docker platform setting.
    • --proxy: Use a proxy to download packages to speed up the build process. The build will use Alibaba Cloud's image source.
    • --help: Display help information.

    Here is an example usage:

    ./build_docker.sh -p linux/amd64 -t private_registry/pika:latest
  • 3.3 Running with docker-compose

docker-compose.yaml

  pikadb:
    image: pikadb/pika:lastest
    container_name: pikadb
    ports:
      - "6379:9221"
    volumes:
      - ./data/pika:/pika/log
      # Specify the configuration file path. If you need to specify a configuration file, specify it here.
      # Note: pika.conf should be in the ./deploy/pika directory
      #- ./deploy/pika:/pika/conf
      - ./data/pika/db:/pika/db
      - ./data/pika/dump:/pika/dump
      - ./data/pika/dbsync:/pika/dbsync
    privileged: true
    restart: always

Performance test

  • Thanks deep011 for providing performance test results.

Note: The test results were obtained under specific conditions and scenarios, and may not represent the performance in all environments and scenarios. They are for reference only.

We recommend that you conduct detailed testing of Pika in your own environment based on the usage scenario to assess whether Pika meets your requirements.

1. Test environment

  • CPU Model: Intel(R) Xeon(R) CPU E5-2690 v4 @ 2.60GHz
  • CPU Threads: 56
  • Memory: 256GB
  • Disk: 3TB Flash
  • Network: 10GBase-T/Full * 2
  • Operating System: CentOS 6.6
  • Pika Version: 2.2.4

2. Benchmarking Tool

vire-benchmark

3. Test Cases

3.1 Case 1

  • Test Objective

Evaluate the upper limit of QPS for Pika under different worker thread counts.

  • Test Conditions
    • Pika Data Size: 800GB
    • Value: 128 bytes
    • CPU not bound
  • Test Results
    1

    Note: The x-axis represents Pika thread count, and the y-axis represents QPS with a value size of 128 bytes. "set3/get7" indicates 30% set and 70% get operations.

  • Case One Conclusion

    From the above graph, it can be observed that setting Pika's worker thread count to 20-24 is more cost-effective.

3.2 Case 2

  • Test Objective

    Evaluate the RTT performance of Pika with the optimal worker thread count (20 threads).

  • Test Conditions
    • Pika Data Size: 800GB
    • Value: 128 bytes
  • Test Results
    ====== GET ======
      10000000 requests completed in 23.10 seconds
      200 parallel clients
      3 bytes payload
      keep alive: 1
    99.89% <= 1 milliseconds
    100.00% <= 2 milliseconds
    100.00% <= 3 milliseconds
    100.00% <= 5 milliseconds
    100.00% <= 6 milliseconds
    100.00% <= 7 milliseconds
    100.00% <= 7 milliseconds
    432862.97 requests per second
    ====== SET ======
      10000000 requests completed in 36.15 seconds
      200 parallel clients
      3 bytes payload
      keep alive: 1
    91.97% <= 1 milliseconds
    99.98% <= 2 milliseconds
    99.98% <= 3 milliseconds
    99.98% <= 4 milliseconds
    99.98% <= 5 milliseconds
    99.98% <= 6 milliseconds
    99.98% <= 7 milliseconds
    99.98% <= 9 milliseconds
    99.98% <= 10 milliseconds
    99.98% <= 11 milliseconds
    99.98% <= 12 milliseconds
    99.98% <= 13 milliseconds
    99.98% <= 16 milliseconds
    99.98% <= 18 milliseconds
    99.99% <= 19 milliseconds
    99.99% <= 23 milliseconds
    99.99% <= 24 milliseconds
    99.99% <= 25 milliseconds
    99.99% <= 27 milliseconds
    99.99% <= 28 milliseconds
    99.99% <= 34 milliseconds
    99.99% <= 37 milliseconds
    99.99% <= 39 milliseconds
    99.99% <= 40 milliseconds
    99.99% <= 46 milliseconds
    99.99% <= 48 milliseconds
    99.99% <= 49 milliseconds
    99.99% <= 50 milliseconds
    99.99% <= 51 milliseconds
    99.99% <= 52 milliseconds
    99.99% <= 61 milliseconds
    99.99% <= 63 milliseconds
    99.99% <= 72 milliseconds
    99.99% <= 73 milliseconds
    99.99% <= 74 milliseconds
    99.99% <= 76 milliseconds
    99.99% <= 83 milliseconds
    99.99% <= 84 milliseconds
    99.99% <= 88 milliseconds
    99.99% <= 89 milliseconds
    99.99% <= 133 milliseconds
    99.99% <= 134 milliseconds
    99.99% <= 146 milliseconds
    99.99% <= 147 milliseconds
    100.00% <= 203 milliseconds
    100.00% <= 204 milliseconds
    100.00% <= 208 milliseconds
    100.00% <= 217 milliseconds
    100.00% <= 218 milliseconds
    100.00% <= 219 milliseconds
    100.00% <= 220 milliseconds
    100.00% <= 229 milliseconds
    100.00% <= 229 milliseconds
    276617.50 requests per second
  • Case 2 Conclusion

    The response time for 99.9% of get/set operations is within 2ms.

3.3 Case 3

  • Test Objective

    Evaluate the maximum QPS for each command in Pika with the optimal worker thread count.

  • Test Conditions
    • Pika Worker Thread Count: 20
    • Number of Keys: 10,000
    • Number of Fields: 100 (excluding lists)
    • Value: 128 bytes
    • Number of Command Executions: 10 million (except for lrange)
  • Test Results
    PING_INLINE: 548606.50 requests per second
    PING_BULK: 544573.31 requests per second
    SET: 231830.31 requests per second
    GET: 512163.91 requests per second
    INCR: 230861.56 requests per second
    MSET (10 keys): 94991.12 requests per second
    LPUSH: 196093.81 requests per second
    RPUSH: 195186.69 requests per second
    LPOP: 131156.14 requests per second
    RPOP: 152292.77 requests per second
    LPUSH (needed to benchmark LRANGE): 196734.20 requests per second
    LRANGE_10 (first 10 elements): 334448.16 requests per second
    LRANGE_100 (first 100 elements): 50705.12 requests per second
    LRANGE_300 (first 300 elements): 16745.16 requests per second
    LRANGE_450 (first 450 elements): 6787.94 requests per second
    LRANGE_600 (first 600 elements): 3170.38 requests per second
    SADD: 160885.52 requests per second
    SPOP: 128920.80 requests per second
    HSET: 180209.41 requests per second
    HINCRBY: 153364.81 requests per second
    HINCRBYFLOAT: 141095.47 requests per second
    HGET: 506791.00 requests per second
    HMSET (10 fields): 27777.31 requests per second
    HMGET (10 fields): 38998.52 requests per second
    HGETALL: 109059.58 requests per second
    ZADD: 120583.62 requests per second
    ZREM: 161689.33 requests per second
    PFADD: 6153.47 requests per second
    PFCOUNT: 28312.57 requests per second
    PFADD (needed to benchmark PFMERGE): 6166.37 requests per second
    PFMERGE: 6007.09 requests per second
  • Conclusion

    Overall performance is excellent, but some commands exhibit weaker performance (LRANGE, PFADD, PFMERGE).

3.4 Case 4

  • Test Objective

    Compare the maximum QPS between Pika and Redis.

  • Test Conditions
    • Pika Worker Thread Count: 20
    • Number of Keys: 10,000
    • Number of Fields: 100 (excluding lists)
    • Value: 128 bytes
    • Number of Command Executions: 10 million (except for LRANGE)
    • Redis Version: 3.2.0
  • Test Result

1

Observability

Metrics

  1. Pika Server Info: system, ip, port, run_id, config file etc.
  2. Pika Data Info: db size, log size, memory usage etc.
  3. Pika Client Info: The number of connected clients.
  4. Pika Stats Info: status information of compact, slot, etc.
  5. Pika Network Info: Incoming and outgoing traffic and rate of client and master-slave replication.
  6. Pika CPU Info: cpu usage.
  7. Pika Replication Info: Status information of master-slave replication, binlog information.
  8. Pika Keyspace Info: key information of five data types.
  9. Pika Command Exec Count Info: command execution count.
  10. Pika Command Execution Time: Time-consuming command execution.
  11. RocksDB Metrics: RocksDB information of five data types, includes Memtable, Block Cache, Compaction, SST File, Blob File etc.

More details on Metrics.

Documents

Contact Us

pika's People

Contributors

4kangjc avatar a2urestone avatar alexstocks avatar axlgrep avatar baerwang avatar baotiao avatar catkang avatar chejinge avatar chenbt-hz avatar chengyu-l avatar cheniujh avatar dependabot[bot] avatar dingxiaoshuai123 avatar fancy-rabbit avatar flabby avatar forestlh avatar jacketwoo avatar kernelai avatar kernelmaker avatar leviathan1995 avatar lqxhub avatar luky116 avatar machinly avatar mixficsol avatar tedli avatar wanghenshui avatar wangshao1 avatar wenduo avatar whoiami avatar yaoyinnan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pika's Issues

How pika lock key when parallel write?

I noticed

slash::RecordMutex mutex_record_;

in PikaServer structure, how does pika lock every key when parallel write?

And every kind of data stucture use the same lock, for example set/zset/kv/list/hash , do these data structure write operation use the same kind of lock mechanism?

list类型做队列发现数据有丢失的情况

环境
客户端:php 7
pika_version:2.1.4
os:Linux 2.6.32-573.26.1.el6.x86_64 x86_64

在cli下单进程插入100,000数据到list队列,lpush入rpop出,经测试顺序一致,速度也很快。

然而在web环境下,并发100时,发现队列数据有丢失。跟踪lpush确实插入成功返回值为1,但rpop时会间隔的漏掉1条、3条,不规律,总体情况是100条丢失45条左右。

不知道有么有人遇到过。

后来直接切换到redis的端口,数据正常。因此排除客户端和环境问题。

pika占用系统内存过大问题?

pika系统对内存分配管理有没有做过控制?

一个测试业务在使用pika,发现随着测试使用,进程实际占用内存一直增长(目前约30G),系统会出现内存不足现象;

Data

db_size:59566M
compression:snappy
used_memory:62459617254
db_memtable_usage:151748356Bytes
db_tablereader_usage:156153589Bytes

Pika write-buffer-size

write-buffer-size : 268435456

max-cache-files default is 5000

max-cache-files : 500

分配60多M的内存好多
00007f9f3c000000 65128 26292 26292 rw--- [ anon ]
00007f9f3ff9a000 408 0 0 ----- [ anon ]
00007f9f40000000 49156 100 100 rw--- [ anon ]
00007f9f43001000 16380 0 0 ----- [ anon ]
00007f9f44000000 63492 128 128 rw--- [ anon ]
00007f9f47e01000 2044 0 0 ----- [ anon ]
00007f9f48000000 62672 52440 52440 rw--- [ anon ]
00007f9f4bd34000 2864 0 0 ----- [ anon ]
00007f9f4c000000 63492 220 220 rw--- [ anon ]
00007f9f4fe01000 2044 0 0 ----- [ anon ]
00007f9f50000000 63492 128 128 rw--- [ anon ]
00007f9f53e01000 2044 0 0 ----- [ anon ]
00007f9f58000000 63492 168 168 rw--- [ anon ]

go语言支持

请问pika支持go语言嘛?
我们现在在做一个区块链项目,数据会一直扩张,请问pika对集群及其可扩展性的支持如何? 如果数据量达到1pb,还能有效支持嘛?

编译错误pika_admin.cc

环境:Ubuntu 14.04
分支:master,tag/v2.0.2

编译pika_admin.cc时,执行到

g++ -O2 -g -pipe -fPIC -W -DNDEBUG -Wwrite-strings -Wpointer-arith -Wreorder -Wswitch -Wsign-promo -Wredundant-decls -Wformat -Wall -Wno-unused-parameter -D_GNU_SOURCE -D__STDC_FORMAT_MACROS -std=c++11 -gdwarf-2 -Wno-redundant-decls -c src/pika_admin.cc -o src/pika_admin.o -I./include/ -I./src/ -I./third/glog/src/ -I./third/nemo/output/include/ -I./third/slash/output/include/ -I./third/pink/output/include/

报错

In file included from ./third/slash/output/include/base_conf.h:6:0,
                 from ./include/pika_conf.h:8,
                 from src/pika_admin.cc:2:
./third/slash/output/include/slash_define.h:6:16: error: expected identifier before '#'
 #define NUMBER '#'

经检查,是third/slash/output/include/slash_define.h的include顺序早于/usr/include/google/protobuf,导致protobuf使用了其中宏NUMBER的定义,从而造成语法错误。

主从配置

不能用配置文件配置主从吗?必须手动执行slaveof命令?

怎么对hash设置ttl?

我看pika的设计,似乎所有类型都支持ttl。请问下,对hash设置ttl该如何使用?

日志问题

write2file这个日志文件主要用途是做什么的,如果太多了,可不可以直接手动删除?还有就是使用默认配置最大数量10个的时候,感觉没起作用,日志文件数量一直在增加

单个key,value的大小有限制吗

HI,

我想了解下,如果在pika中使用key-value结构存储数据,对一个key,value对的容量有限制吗?
使用hashmap结构存储时,对单个有容量限制吗?

客户端连接数问题

您好:
目前使用pika中发现了一个问题。正常情况下一个pika节点的客户端连接数在270-300之间,但连接数有时候会有波动,到一个350-400连接数的峰值,监控如图。
image

在这些峰值的时间点,都会出现检查节点状态时ping无响应,读取错误等故障。查看日志未发现明显问题,请问有没有什么解决思路,以及pika本身时候有什么限制,谢谢。

当前服务状态:

127.0.0.1:6379> info

Server

pika_version:2.1.0
os:Linux 2.6.32-431.el6.centos.plus.x86_64 x86_64
arch_bits:64
process_id:3150
tcp_port:6379
thread_num:8
sync_thread_num:4
uptime_in_seconds:23350
uptime_in_days:1
config_file:/data/pika/conf/pika.conf

Data

db_size:30618M
compression:snappy
used_memory:32105758360
db_memtable_usage:404912908Bytes
db_tablereader_usage:338472679Bytes

Log

log_size:9536M
safety_purge:write2file3122
expire_logs_days:7
expire_logs_nums:10
write2file:3132

Clients

connected_clients:285

Stats

total_connections_received:27792
instantaneous_ops_per_sec:2280
total_commands_processed:58205799
is_bgsaving:No, , 0
is_scaning_keyspace:No
is_compact:No

Replication(MASTER)

role:master
connected_slaves:0

Keyspace

Time:2016-08-18 13:01:52

kv keys:1934565
hash keys:0
list keys:0
zset keys:2253399
set keys:0

写入可靠性问题

pika的写操作可靠性怎么样?是同步落盘吗?还是只保证写入缓存?

Is there any way to adjust the memory limit of pika?

If we have a machine with a relatively large memory, and want pika to make full use of it to improve efficiency, how can we adjust the config file? (It seems that "write-buffer-size" is related to this problem, but pika seems to store "write-buffer-size" in an integer variable, which is at most 2^31-1 (roughly 2GB), and not big enough.)

如何解决进行keys操作时内存溢出的问题?

之前使用redis时,内存已经30G+,所以准备改用pika。但是对数据库进行操作时,有时会用keys命令,使用keys命令时,得到如下错误:

_File "/usr/lib/python2.6/site-packages/redis/client.py", line 568, in keys

return self.execute_command('KEYS', pattern)

File "/usr/lib/python2.6/site-packages/redis/client.py", line 330, in execute_command
*_options
File "/usr/lib/python2.6/site-packages/redis/client.py", line 312, in _execute_command
return self.parse_response(command_name, *_options)
File "/usr/lib/python2.6/site-packages/redis/client.py", line 390, in parse_response
response = self._parse_response(command_name, catch_errors)
File "/usr/lib/python2.6/site-packages/redis/client.py", line 349, in parse_response
raise ResponseError(response)
redis.exceptions.ResponseError: buf is too large

已经试过修改源码中REDIS_MAX_MESSAGE的值,可是依旧报相同的错误。
也试过用scan命令进行扫库,但是效率比redis的scan差很多,不符合使用的要求

同步问题

我pika主库需要重启,但重启后发现从库报错Could not purge 1, since it is already be used, 这个是什么原因

support pika for redis-cluster protocol

We have supported codis to scale out pika. Nevertheless, we think the proxy solution is not the perfect solution, and cluster is the future. We want add the support for the redis cluster protocol to support cluster solution.

write_buffer_size in pika.conf

When I query the write_buffer_size using "config get write_buffer_size" in redis-cli, the value returned is different from the value specified in pika.conf. Which one is the real size of the write buffer? Or do they have different units?

主从问题

1、master端需要密码认证时,在slave端使用slaveof命令,无法连接到master。 请问如何在master有密码的情况下,slave端能成功连接?
2、在slave端使用slaveof命令时,偶尔会出现以下错误,无法连接到master:
I0811 17:52:15.360584 31455 pika_admin.cc:118] Trysync, Slave ip_port: xxx.xxx.xxx.xxx:9221 filenum: 0 pro_offset: 0 I0811 17:52:15.361500 31455 pika_admin.cc:130] Trysync, dont FindSlave, so AddBinlogSender rsync: read error: Connection reset by peer (104) rsync error: error in rsync protocol data stream (code 12) at io.c(759) [sender=3.0.6] W0811 17:52:15.366693 31487 pika_server.cc:577] rsync send file failed! From: ./dump/20160811/list/000025.sst, To: list/000025.sst, At: xxx.xxx.xxx.xxx:12221, Error: 3072 rsync: read error: Connection reset by peer (104) rsync error: error in rsync protocol data stream (code 12) at io.c(759) [sender=3.0.6] rsync: read error: Connection reset by peer (104) rsync error: error in rsync protocol data stream (code 12) at io.c(759) [sender=3.0.6] rsync: read error: Connection reset by peer (104) rsync error: error in rsync protocol data stream (code 12) at io.c(759) [sender=3.0.6] rsync: read error: Connection reset by peer (104) rsync error: error in rsync protocol data stream (code 12) at io.c(759) [sender=3.0.6] rsync: read error: Connection reset by peer (104) rsync error: error in rsync protocol data stream (code 12) at io.c(759) [sender=3.0.6]

出现的概率很小,但是出现以后,即使执行重启服务、清库等操作,主从也无法连接成功。

db_bench db_stress crash

at master brench
db_bench db_stress crash

log:

#0 ./db_bench() [0x476442] rocksdb::CompactionJob::ProcessKeyValueCompaction(long*, rocksdb::Iterator*, bool) /home/cltx/tangyi/pika/third/nemo/3rdparty/rocksdb/db/compaction_job.cc:636
#1 ./db_bench() [0x47a1e5] rocksdb::Status::operator=(rocksdb::Status const&) /home/cltx/tangyi/pika/third/nemo/3rdparty/rocksdb/./include/rocksdb/status.h:157
#2 ./db_bench() [0x4946c5] rocksdb::DBImpl::BackgroundCompaction(bool*, rocksdb::JobContext*, rocksdb::LogBuffer*) /home/cltx/tangyi/pika/third/nemo/3rdparty/rocksdb/db/db_impl.cc:2444
#3 ./db_bench() [0x4a011f] rocksdb::DBImpl::BackgroundCallCompaction() /home/cltx/tangyi/pika/third/nemo/3rdparty/rocksdb/db/db_impl.cc:2147
#4 ./db_bench() [0x52fa7f] BGThread /home/cltx/tangyi/pika/third/nemo/3rdparty/rocksdb/util/env_posix.cc:1702

How about add support for lua script?

Some times we need operations like CAS(compare and set), lua script can make it atomic and also get good performance by reducing number of times of remote call.

pika写时慢查询

碰到写数据时,出现慢查询 —— cost > 100ms。

  1. 部署的结构 :单台机器上一主两从,多台机器交叉主从关系。机器内存 128G、磁盘ssd。
  2. 数据情况: value 大小在 10 ~ 20k 左右, 现在每个实例存储了 80G 数据
  3. 写并发情况:每个实例 200 W/s (基准测试时可以支持 3.6w W/s)。每个实例,每次平均更新 40w KV。
  4. 内存使用情况: 从节点 (VIRT)2046m (RES)543m

一些想法:

  1. 限制主从同步速度来降低从节点的写入速度。但是写入压力不大,粗略估计 15M/s 就到顶了。
  2. 增大缓存,避免出现慢查询。现在配置 max-cache-files : 5000,默认应该最多可以90G内存。

以上两种办法,自己评估了下好像都问题的根源。对pika了解的不够,希望能给些建议。

现在的配置文件:

# Pika port
port : 30001
# Thread Number
thread-num : 10
# Sync Thread Number
sync-thread-num : 6
# Item count of sync thread queue
sync-buffer-size : 10
# Pika log path
log-path : /usr/local/logs/pika/30001
# Pika glog level: only INFO and ERROR
loglevel : info
# Pika db path
db-path : /data/pika/db/30001
# Pika write-buffer-size
write-buffer-size : 268435456
# Pika timeout
timeout : 60
# Requirepass
requirepass :
# Userpass
userpass :
# User Blacklist
userblacklist :
# Dump Prefix
dump-prefix :
# daemonize  [yes | no]
daemonize : yes
# Dump Path
dump-path : /usr/local/data/pika/dump/30001
# pidfile Path
pidfile : /var/run/pika/30001.pid
# Max Connection
maxclients : 20000
# the per file size of sst to compact, defalut is 2M
target-file-size-base : 20971520
# Expire-logs-days
expire-logs-days : 7
# Expire-logs-nums
expire-logs-nums : 10
# Root-connection-num
root-connection-num : 2
# Slowlog-log-slower-than
slowlog-log-slower-than : 10000
# slave-read-only(yes/no, 1/0)
slave-read-only : 0
# Pika db sync path
db-sync-path : /usr/local/data/pika/dbsync/30001
# db sync speed(MB) max is set to 125MB, min is set to 0, and if below 0 or above 125, the value will be adjust to 125
db-sync-speed : -1
# network interface
 network-interface : eth0
# replication
slaveof : 

###################
## Critical Settings
###################
# binlog file size: default is 100M,  limited in [1K, 2G]
binlog-file-size : 104857600
# Compression
compression : snappy
# max-background-flushes: default is 1, limited in [1, 4]
max-background-flushes : 1
# max-background-compactions: default is 1, limited in [1, 4]
max-background-compactions : 1
# max-cache-files default is 5000
max-cache-files : 5000

Does pika support pipeline mode?

Hey, I want to know
1 .Does pika support pipeline mode of redis?
2. If yes, how does pika gurantee the sequence of excution in multi work thread environment?
Thanks.

slaveof masterip port error

127.0.0.1:29221> slaveof 192.168.6.158 9221
OK
127.0.0.1:29221> info

Replication(SLAVE)

role:slave
master_host:192.168.6.158
master_port:9221
master_link_status:# down
slave_read_only:1
127.0.0.1:29221> info

Replication(MASTER)

role:single
connected_slaves:0

I have try many time .
Just one way can be OK:

127.0.0.1:29221> slaveof 127.0.0.1 9221
OK
127.0.0.1:29221> info

Replication(SLAVE)

role:slave
master_host:0.0.0.0
master_port:9221
master_link_status:up
slave_read_only:1

but statistic is error:
kv keys:0

PIKA对pipeline的支持如何?

请问有针对pipeline方面的性能测试吗?

目前我们自己测试,如果超过3w的pipeline就会出现一个很大时延,基本服务就不可用了。

install problems

我测试了一下快速安装和编译安装,发现安装完成后大小不一样。这两种安装在我们这边有什么区别?是否都可以直接在线上使用?还有就是在我插入数据后,快速安装的数据目录并没有占用多大空间,编译安装的数据目录每个目录都会生成很大的日志文件,有2.7G,这是正常的吗?

Unix domain socket

请问pika现在支持 Unix domain socket吗?

我在配置文件里似乎没有看到这项

谢谢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.