Cross-platform lightweight redis, SSDB Proxy Server (c + + 11 authoring)

Source: Internet
Author: User
Tags lua

Dbproxy is my amateur cross-platform proxy server written in c++11 (and using LUA and its own network library) to extend system load while using multiple back-end databases, and the back-end database supports Redis and SSDB.

It is up to the user to write Lua scripts to control sharding. The test efficiency is slightly higher than Codis and consumes less CPU and memory.

Here is the readme on GitHub, which I copied directly:

Introduced

Dbproxy is a proxy server written with c++11 that supports Redis and SSDB databases. It is mainly used for expanding and increasing system load. Use LUA to control sharding and map different key-value to different back-end Redis or SSDB servers.

Build

Dbproxy supports Windwos and Linux.

    • Windows: Open the DBProxy.sln compilation of the root directory.
    • Linux:
      • 1: Execute commands in the project root directory cd 3rdparty/luasrc/src/ into the LUA src directory, then perform the make generic buildliblua.so
      • 2: Return to the project root directory execution cp 3rdparty/luasrc/src/liblua.so . will be liblua.so copied to the current directory.
      • 3: Continue to execute the build under the root directory make server dbserver .
      • 4: Run directly./dbserver The proxy server is started.
Configuration file

The Dbproxy configuration file is config.lua its ProxyConfig backends key configuration back-end server list, which sharding_function indicates the sharding function. As an example, the test_sharding specified sharding function, which returns the corresponding server number according to the key parameter, returns 0, which means that the key is mapped to 127.0.0.1 : 6379 this server.

Redis or SSDB using a proxy server is almost indistinguishable from using Redis or SSDB, and with any Redis or SSDB client, the code does not have to be adjusted, just the IP and port point to the proxy server's address.

Add

Currently, dbproxy only acts as a proxy mapping, does not include read-write separation and additional caching, and does not solve distributed problems. Of course, its server C + + code body does not involve any sharding scheme, it must be implemented by the user himself in the Config.lua sharding function (of course, can also be found from the Internet, such as the LUA version of the consistent hash Lua-consistent-hash)

Thank

To some extent, it draws on Redis-shatter and Codis.

Subsequent:

Efficiency can be further improved and optimized, thank you for trying to give advice.

Cross-platform lightweight redis, SSDB Proxy Server (c + + 11 authoring)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.