Coder Social home page Coder Social logo

spring-boot-jdbc-sharding's Introduction

spring-boot-jdbc-sharding

特点

精简实用:不到10个类;可按一致性哈希进行水平分片,并提供精简的读写分离、负载均衡以及跨分片操作能力

轻量高效:分片操作只需计算哈希、线程绑定两步即可完成,性能损耗极小

容易上手:准备阶段理想情况下只需配置各个数据源的url即可,实施阶段只需增加一个注解

无侵入性:完全不需要修改以前的代码

无缝融合:分片模式与非分片模式可一并使用,也可择一而用

细节

线程绑定:动态数据源

注解&AOP:拦截 CRUD 方法,其中 @Sharding 为单分片模式,@Crossing 为跨分片模式

SpEL:分片关键字采用含有方法参数的SpEL表达式表示,参考 @Cacheable#key

哈希算法:选用 MurmurHash3 实现一致性哈希

限制

只支持库级别的分片,不支持分表

只支持按一致性哈希算法进行分片,不支持按范围或其他算法

不支持由于分片数量变化而带来的数据自动重新分布

不支持跨库事务,单库事务仍然可用

只支持读负载均衡,不支持写负载均衡

spring-boot-jdbc-sharding's People

Contributors

daiguocheng avatar

Stargazers

 avatar

Watchers

 avatar

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.