Skip to content

Releases: Ahoo-Wang/CosId

v1.4.8

13 Dec 15:04
Compare
Choose a tag to compare
  • Enhancement: add ExactCollection , mainly for scenarios where Interval sharding algorithm and Mod sharding algorithm can predict the number of nodes in advance. Improve performance and memory utilization.
  • Add: CosIdModShardingAlgorithm to re implement the module sharding algorithm and improve performance.
    CosIdModShardingAlgorithm
  • Add:JMH ModShardingAlgorithmBenchmark,CosIdModShardingAlgorithm VS org.apache.shardingsphere.sharding.algorithm.sharding.mod.ModShardingAlgorithm
PreciseShardingValue RangeShardingValue
Throughput-Of-ModShardingAlgorithm-PreciseShardingValue Throughput-Of-ModShardingAlgorithm-RangeShardingValue

  • 增强:新增 ExactCollection(准确式集合),主要针对 Interval 分片算法、Mod 分片算法可以提前预知节点数量的场景。提升性能与内存利用率。
  • 新增:CosIdModShardingAlgorithm 以重新实现取模分片算法,提升性能。
    CosIdModShardingAlgorithm
  • 新增:基准测试 ModShardingAlgorithmBenchmark,CosIdModShardingAlgorithm VS org.apache.shardingsphere.sharding.algorithm.sharding.mod.ModShardingAlgorithm
PreciseShardingValue RangeShardingValue
Throughput-Of-ModShardingAlgorithm-PreciseShardingValue Throughput-Of-ModShardingAlgorithm-RangeShardingValue

v1.4.6

11 Dec 16:36
Compare
Choose a tag to compare
  • add SmartIntervalShardingAlgorithm(COSID_INTERVAL) to support COSID_INTERVAL_DATE, COSID_INTERVAL_LDT , COSID_INTERVAL_TS and COSID_INTERVAL_TS_SECOND together

v1.4.5

10 Dec 14:41
Compare
Choose a tag to compare
  • add CosIdIntervalShardingAlgorithm to implement org.apache.shardingsphere.sharding.spi.ShardingAlgorithm to improve the performance and ease of use
    CosIdIntervalShardingAlgorithm
    • Ease of use: supports multiple data types (Long/LocalDateTime/Date),The official implementation is to first convert to a string and then convert to LocalDateTime, the conversion success rate is affected by the time formatting characters.
    • Performance: Compared to org.apache.shardingsphere.sharding.algorithm.sharding.datetime.IntervalShardingAlgorithm,The performance is 1200~4000 times higher.

Interval-based-sharding-algorithm-jmh

  • Interval-based time range sharding algorithm
    • DateIntervalShardingAlgorithm (COSID_INTERVAL_DATE)
    • LocalDateTimeIntervalShardingAlgorithm (COSID_INTERVAL_LDT)
    • SnowflakeIntervalShardingAlgorithm (COSID_INTERVAL_SNOWFLAKE)
    • TimestampIntervalShardingAlgorithm (COSID_INTERVAL_TS)
    • TimestampOfSecondIntervalShardingAlgorithm (COSID_INTERVAL_TS_SECOND)
spring:
  shardingsphere:
    rules:
      sharding:
        sharding-algorithms:
          alg-name:
            type: COSID_INTERVAL_{type_suffix}
            props:
              logic-name: logic-name
              id-name: cosid-name
              datetime-lower: 2021-12-08T22:00:00
              datetime-upper: 2022-12-01T00:00:00
              sharding-suffix-pattern: _yyyyMM
              datetime-interval-unit: MONTHS
              datetime-interval-amount: 1
  • add JMH test for CosIdIntervalShardingAlgorithm VS org.apache.shardingsphere.sharding.algorithm.sharding.datetime.IntervalShardingAlgorithm
gradle cosid-shardingsphere:jmh
# JMH version: 1.29
# VM version: JDK 11.0.13, OpenJDK 64-Bit Server VM, 11.0.13+8-LTS
# VM options: -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/work/CosId/cosid-shardingsphere/build/tmp/jmh -Duser.country=CN -Duser.language=zh -Duser.variant
# Blackhole mode: full + dont-inline hint
# Warmup: 1 iterations, 10 s each
# Measurement: 1 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
Benchmark                                                          Mode  Cnt         Score   Error  Units
IntervalShardingAlgorithmBenchmark.cosid_precise_local_date_time  thrpt       66276995.822          ops/s
IntervalShardingAlgorithmBenchmark.cosid_precise_timestamp        thrpt       24841952.001          ops/s
IntervalShardingAlgorithmBenchmark.cosid_range_local_date_time    thrpt        3344013.803          ops/s
IntervalShardingAlgorithmBenchmark.cosid_range_timestamp          thrpt        2846453.298          ops/s
IntervalShardingAlgorithmBenchmark.office_precise_timestamp       thrpt           6286.861          ops/s
IntervalShardingAlgorithmBenchmark.office_range_timestamp         thrpt           2302.986          ops/s
  • Open interface SnowflakeFriendlyId.getParser
  • fix JdbcIdSegmentInitializer construction parameter error(CosIdJdbcSegmentAutoConfiguration,jdbcIdSegmentInitializer)

  • 新增 CosIdIntervalShardingAlgorithm 实现 org.apache.shardingsphere.sharding.spi.ShardingAlgorithm 以提升INTERVAL性能与易用性
    CosIdIntervalShardingAlgorithm
    • 易用性: 原生支持多种数据类型 (LongLocalDateTimeDate),而官方实现是先转换成字符串再转换成LocalDateTime,转换成功率受时间格式化字符影响。

    • 性能 : 相比于官方实现org.apache.shardingsphere.sharding.algorithm.sharding.datetime.IntervalShardingAlgorithm 性能至少高出 1200~4000 倍。
      Interval-based-sharding-algorithm-jmh

    • 基于间隔的时间范围分片算法

    • DateIntervalShardingAlgorithm (COSID_INTERVAL_DATE)

    • LocalDateTimeIntervalShardingAlgorithm (COSID_INTERVAL_LDT)

    • SnowflakeIntervalShardingAlgorithm (COSID_INTERVAL_SNOWFLAKE)

    • TimestampIntervalShardingAlgorithm (COSID_INTERVAL_TS)

    • TimestampOfSecondIntervalShardingAlgorithm (COSID_INTERVAL_TS_SECOND)

spring:
  shardingsphere:
    rules:
      sharding:
        sharding-algorithms:
          alg-name:
            type: COSID_INTERVAL_{type_suffix}
            props:
              logic-name: logic-name
              id-name: cosid-name
              datetime-lower: 2021-12-08T22:00:00
              datetime-upper: 2022-12-01T00:00:00
              sharding-suffix-pattern: _yyyyMM
              datetime-interval-unit: MONTHS
              datetime-interval-amount: 1
  • 新增基准测试CosIdIntervalShardingAlgorithm VS org.apache.shardingsphere.sharding.algorithm.sharding.datetime.IntervalShardingAlgorithm
gradle cosid-shardingsphere:jmh
# JMH version: 1.29
# VM version: JDK 11.0.13, OpenJDK 64-Bit Server VM, 11.0.13+8-LTS
# VM options: -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/work/CosId/cosid-shardingsphere/build/tmp/jmh -Duser.country=CN -Duser.language=zh -Duser.variant
# Blackhole mode: full + dont-inline hint
# Warmup: 1 iterations, 10 s each
# Measurement: 1 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
Benchmark                                                          Mode  Cnt         Score   Error  Units
IntervalShardingAlgorithmBenchmark.cosid_precise_local_date_time  thrpt       66276995.822          ops/s
IntervalShardingAlgorithmBenchmark.cosid_precise_timestamp        thrpt       24841952.001          ops/s
IntervalShardingAlgorithmBenchmark.cosid_range_local_date_time    thrpt        3344013.803          ops/s
IntervalShardingAlgorithmBenchmark.cosid_range_timestamp          thrpt        2846453.298          ops/s
IntervalShardingAlgorithmBenchmark.office_precise_timestamp       thrpt           6286.861          ops/s
IntervalShardingAlgorithmBenchmark.office_range_timestamp         thrpt           2302.986          ops/s
  • API调整: 开放接口 SnowflakeFriendlyId.getParser
  • 修复: JdbcIdSegmentInitializer 构造函数赋值错误问题 #I4LVBZ (CosIdJdbcSegmentAutoConfiguration,jdbcIdSegmentInitializer)

v1.4.0

04 Dec 06:14
Compare
Choose a tag to compare

add CosIdKeyGenerateAlgorithm to support org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm(cosid-shardingsphere)

Kotlin DSL

    implementation("me.ahoo.cosid:cosid-shardingsphere:${cosidVersion}")
spring:
  shardingsphere:
    rules:
      sharding:
        key-generators:
          cosid:
            type: COSID
            props:
              id-name: __share__

v1.3.19

02 Dec 13:08
Compare
Choose a tag to compare
  • performance:Use AtomicLongFieldUpdater to replace AtomicLong to reduce the memory allocation of new objects.
  • fix typo
  • optimize:CacheClock supports responding to interrupt signals

1.3.18

10 Nov 12:43
Compare
Choose a tag to compare
  • Support custom time zone (SnowflakeFriendlyId).
  • Override SnowflakeFriendlyId.generateAsString to return friendlyId (default).

1.3.17

15 Sep 12:37
Compare
Choose a tag to compare
  • fix the potential shift overflow problem of machineId

1.3.14

25 Aug 16:26
Compare
Choose a tag to compare
  • Upgrade to CoSky 1.3.1
  • Upgrade to Spring-Boot 2.4.10

1.3.13

12 Aug 12:37
Compare
Choose a tag to compare
  • add UuidGenerator
  • add the rollback detection of the nextMaxId(RedisIdSegmentDistributor)

1.3.12

05 Aug 16:09
Compare
Choose a tag to compare
  • refactor CosIdAnnotationSupport
  • add CosIdAccessor
    • support class inheritance
    • use getter/setter first
  • no longer supports single instance to define multiple @CosId annotations