Skip to content

Commit c29cac5

Browse files
author
gaohaoxiang
committed
完善shade,transport支持多地址,fastjson改为gson
2 parents 588a353 + 9ee6714 commit c29cac5

47 files changed

Lines changed: 579 additions & 1561 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ A JoyQueue performance test results here:
3232

3333
Scenario settings:
3434

35-
Scenario | Sync/Async | Batch | Compress | Msg size | Partitions
35+
Scenario | Sync/Async | Batch | Compress | Msg size | Partitions | Client SDK
3636
-- | -- | -- | -- | -- | -- | --
37-
**Online service** | Sync | 1 | Not compressed | 1KB | 200
38-
**Streaming** | Async | 100 | LZ4 | 1KB | 200
37+
**Online service** | Sync | 1 | Not compressed | 1KB | 200 | joyqueue-client-4.1.0
38+
**Streaming** | Async | 100 | LZ4 | 1KB | 200 | kafka-clients-2.1.1
3939

40-
For detail,visit [Performance](docs/en/performance.md)
40+
For detail,visit [Performance](./docs/cn/performance.md)
4141

4242
## Quickstart
4343

44-
Visit [Quick start](docs/en/quickstart.md)
44+
Visit [Quick start](./docs/cn/quickstart.md)
4545

4646
## Documentation
4747

48-
Visit [Documentation Index](docs/en/index.md)
48+
Visit [Documentation Index](./docs/cn/index.md)
4949

5050
## Contributing
5151

docs/cn/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@ JoyQueue的一组性能测试数据:
3131

3232
测试场景的定义是:
3333

34-
场景 | 发送方式 | 批量大小 | 消息压缩方式 | 测试消息大小 | 分区数量
34+
场景 | 发送方式 | 批量大小 | 消息压缩方式 | 测试消息大小 | 分区数量 | 客户端
3535
-- | -- | -- | -- | -- | -- | --
36-
**在线业务场景** | 同步 | 1 | 不压缩 | 1KB | 200
37-
**流计算场景** | 异步 | 100 | LZ4 | 1KB | 200
36+
**在线业务场景** | 同步 | 1 | 不压缩 | 1KB | 200 | joyqueue-client-4.1.0
37+
**流计算场景** | 异步 | 100 | LZ4 | 1KB | 200 | kafka-clients-2.1.1
3838

39-
详细的测试情况,请查看[性能](performance.md)
39+
详细的测试情况,请查看[性能](./performance.md)
4040

4141
## 快速开始
4242

43-
查看[快速开始](quickstart.md)
43+
查看[快速开始](./quickstart.md)
4444

4545
## 文档
4646

47-
查看[文档目录](index.md)
47+
查看[文档目录](./index.md)
4848

4949
## 参与贡献
5050

docs/cn/cluster.md

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,47 @@
11
# JoyQueue 集群部署
22

3-
JoyQueue的集群由元数据集群和 partition group 多副本集群共同组成
3+
JoyQueue支持集群部署。不同于其它的消息平台,JoyQueue在集群部署时,不需要依赖任何外部服务,只需要通过简单的配置即可实现可靠的大规模集群
44

5-
JoyQueue的元数据管理依赖于Ignite服务,JoyQueue启动时会在同一进程内启动一个Ignite client或server。
6-
多个JoyQueue实例可以通过配置`nameserver.ignite.discoverySpi.ipFinder.address`在相同的ip范围或列举具体的ip,使它们组成元数据集群。
7-
可以通过配置`nameserver.ignite.clientMode`指定Ignite节点的角色,默认为true。当clientMode=true时,本地Ignite作为Ignite server会保存元数据,否则不保存元数据。
8-
Ignite的所有配置均可通过`joyqueue.properties`文件覆盖默认值。
5+
## 元数据服务
96

10-
JoyQueue的partition group 是一个独立的Raft集群。在创建topic时选择多个broker,则topic的partition groups将尽可能均匀的分布在broker上。
11-
JoyQueue依赖于Raft一致性协议来保障消息的可靠性,任意partition group都有多个副本,默认为三副本。
7+
JoyQueue Server内置元数据服务(也叫NameServer或NameService),元数据存储在每个节点的本地磁盘上。JoyQueue Server可以以server或者thin两种模式启动,以server模式启动的节点提供元数据服务,存储元数据;以thin模式启动的节点只访问元数据,不存储元数据。
128

13-
以三个节点的JoyQueue实例为例,假设ip分别为192.169.0.2,192.169.0.3,192.169.0.4。joyqueue.properties 文件包含如下配置:
9+
只要提供元数据服务的节点中,超过半数以上的节点存活,集群就可以持续提供服务。建议一个集群内NameServer节点(nameserver.nsr.name = server)配置为3个或者5个,其它节点配置为thin模式(nameserver.nsr.name = thin ), 即ThinServer。无论是NameServer还是ThinServer都可以提供收发消息的服务。
1410

11+
![JoyQueue集群](../images/cluster.png)
1512

16-
```
13+
## 配置集群
1714

18-
nameserver.ignite.discoverySpi.ipFinder.address=192.169.0.2:48500..48520;,192.169.0.3:48500..48520;,192.169.0.4:48500..48520
15+
例如,配置5个节点的集群,其中3个NameServer,2个ThinServer。
16+
17+
| IP | 类型 |
18+
| -- | -- |
19+
| 192.168.1.1 | NameServer |
20+
| 192.168.1.2 | NameServer |
21+
| 192.168.1.3 | NameServer |
22+
| 192.168.1.4 | ThinServer |
23+
| 192.168.1.5 | ThinServer |
1924

20-
```
2125

22-
分别启动这三个JoyQueue实例。新建主题joy_topic,在broker列表同时选择如上的三个ip,此时三副本的joy_topic就创建完成。
26+
所有的NameServer中,需要配置属性`nameserver.ignite.discoverySpi.ipFinder.address`来互相发现。NameServer需要在配置文件joyqueue.properties中配置:
2327

28+
```properties
29+
nameserver.nsr.name=server
30+
# 如果不配置端口,使用默认的发现端口
31+
nameserver.ignite.discoverySpi.ipFinder.address=192.168.1.1,192.168.1.2,192.168.1.3
32+
```
2433

34+
ThinServer中,需要配置NameServer的元数据服务地址和端口`nameservice.serverAddress`用于访问元数据服务。ThinServer需要在配置文件joyqueue.properties中配置:
2535

36+
```properties
37+
nameserver.nsr.name=thin
38+
nameservice.serverAddress=192.168.1.1:50092,192.168.1.2:50092,192.168.1.3:50092
39+
```
2640

41+
对应的JoyQueue Web需要在配置文件application.properties中配置:
2742

43+
```properties
44+
joyqueue.servers=192.168.1.1,192.168.1.2,192.168.1.3
45+
```
2846

47+
配置成功后,可以打开JoyQueue Web,在“系统管理-Broker管理”中看到集群中所有的节点。

docs/cn/concepts.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# 概念
2+
3+
JoyQueue采用的消息模型是标准的“发布-订阅模型(Publish-Subscribe Pattern)”,本文对JoyQueue中使用的消息模型和涉及到的概念做简明的介绍。
4+
5+
## 基础概念
6+
7+
### 主题/Topic
8+
9+
主题是发布和订阅消息的基本单位。
10+
11+
### 分区/Partition
12+
13+
主题中包含一个或多个分区。一个主题的多个分区可以分布在多个Broker上,用于并行的生产和消费,提升主题总体的吞吐量。主题中的分区和动态的增加或者减少,实现水平扩缩绒。
14+
15+
### Broker/JoyQueue Server
16+
17+
Broker是JoyQueue的服务端进程,也成为JoyQueue Server。
18+
19+
### 应用/App
20+
21+
应用是JoyQueue的使用者,可以是生产者也可以是消费者,一个应用可以有多个实例。
22+
23+
### 生产者/Producer
24+
25+
即消息发送端的应用程序。
26+
27+
### 消费者/Consumer
28+
29+
消息接收端的应用程序。
30+
31+
## 高级概念
32+
33+
### 分区组
34+
35+
分区组包含一组分区,同一组分区分布在同一个Broker,共享一个复制集群。
36+
37+
### Broker分组
38+
39+
Broker分组包含一组Broker,主要目的是便于管理Broker。
40+
41+
### 命名空间
42+
43+
即主题的命名空间,创建主题时可以指定命名空间,同一命名空间下主题具有唯一性。
44+
45+
### 消费组
46+
47+
在消费时,默认一个应用消费主题一份完整消息,如果应用的启动多个消费者实例,那这些实例之间是竞争消费,每条消息最多只能被一个实例消费。
48+
49+
如果一个应用需要同时消费同一主题多次,可以通过配置多个消费组来实现。例如,同一个应用,线上环境和预发环境都希望能各自完整消费同一主题的消息,就可以各自配置一个消费组。每个消费组包含一份完整的消息。

docs/cn/configurations.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# 配置
2+
3+
## JoyQueue Server 配置
4+
5+
JoyQueue Server的配置文件位于joyqueue-server/conf/joyqueue.properties。
6+
7+
配置项 | 默认值 | 说明
8+
-- | -- | --
9+
application.data.path | ${HOME}/joyqueue | JoyQueue数据目录
10+
broker.frontend-server.transport.server.port | 50088 | JoyQueue Server与客户端通信的端口。JoyQueue Server 会启用**连续的5个端口**用于通信,默认为:50088 - 50092。如果修改客户端端口号,其它的端口会自动跟随修改。
11+
-- | broker.frontend-server.transport.server.port + 1(50089) | 内部端口,JoyQueue Server各节点之间通信的端口
12+
-- | broker.frontend-server.transport.server.port + 2(50090) | JoyQueue Server rest API 端口,
13+
-- | broker.frontend-server.transport.server.port + 3(50091) | JoyQueue Web 使用这个端口与JoyQueue Server通信。
14+
-- | broker.frontend-server.transport.server.port + 4(50092) | 内部端口,JoyQueue Server 元数据服务端口。
15+
broker.opts.memory | -Xms2G -Xmx2G -server -Xss256K -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:CMSMaxAbortablePrecleanTime=20 -XX:-OmitStackTraceInFastThrow -XX:MaxDirectMemorySize=2G | jvm 参数。
16+
store.message.file.size | 128 MB | 消息文件大小
17+
store.index.file.size | 512 KB | 索引文件大小
18+
store.preload.buffer.core.count | 3 | 预加载DirectBuffer的核心数量
19+
store.preload.buffer.max.count | 10 | 预加载DirectBuffer的最大数量
20+
store.max.message.length | 4 MB | 每条消息的最大长度
21+
store.write.request.cache.size | 1024 | 写入请求缓存中,最多缓存的请求数量
22+
store.write.timeout | 3000 ms | 存储写入超时时间
23+
store.flush.interval | 20 ms | 存储刷盘时间间隔
24+
store.max.dirty.size | 10 MB| 脏数据的最大长度,如果内存中未刷盘的脏数据长度超过这个值,将阻塞消息写入。
25+
print.metric.interval | 0 ms | 打印存储监控信息的时间间隔,默认为0, 不打印。
26+
store.max.store.size | 10 GB | 每个分区组最多保留消息的大小,超过这个大小之后,旧的消息将被自动删除。
27+
store.max.store.time | 7 天 | 每个分区组最长保留消息的时长,超时的消息将被自动删除。
28+
store.clean.donot.delete.consumed | true | 不删除已订阅未消费的消息。默认对于已经订阅但还未消费的消息,即使满足删除条件,也不会自动删除。
29+
nameserver.nsr.name | server | NameServer的启动方式:<br/> server: 默认的启动方式,存储元数据。<br/> thin: 不存储元数据,远程去其它Server读写元数据。
30+
nameservice.serverAddress | 127.0.0.1:50092 | thin模式时,需要连接其它Server获取元数据,在这里配置其它Server的地址。这里配置的Server中,NameServer的启动方式必须是server模式。支持配置多个地址,用英文逗号隔开。例如:192.168.1.1:50092,192.168.1.2:50092。
31+
nameserver.ignite.discoverySpi.localPort | 48500| Ignite服务发现本地端口
32+
nameserver.ignite.discoverySpi.localPortRange | 20 | Ignite服务发现本地端口范围
33+
nameserver.ignite.discoverySpi.networkTimeout | 5000 ms | Ignite服务发现超时
34+
nameserver.ignite.discoverySpi.ipFinder.address | 127.0.0.1 | Ignite本地服务发现地址范围,支持多个地址,例如:1.2.3.4,1.2.3.5:47500..47509
35+
nameserver.ignite.communicationSpi.localPort | 48100 | Ignite使用的通信端口号
36+
37+
## JoyQueue Web 配置
38+
39+
JoyQueue Web的配置文件位于joyqueue-web/conf/application.properties。
40+
41+
配置项 | 默认值 | 说明
42+
-- | -- | --
43+
vertx.http.port | 10031 | Web服务端口
44+
joyqueue.servers | 127.0.0.1:50091 | 提供元数据服务的JoyQueue Server地址和端口。支持配置多个地址,用逗号分开,默认端口为50091。例如:192.168.1.1,192.168.1.2:8888

docs/cn/Index.md renamed to docs/cn/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
## 使用教程
66

7-
1. [基础概念](concepts.md)
8-
2. [客户端使用说明](client.md)
9-
3. [配置JoyQueue](configurations.md)
10-
4. [Rest API](rest_api.md)
11-
5. [部署JoyQueue集群](cluster.md)
7+
1. [基础概念](./concepts.md)
8+
2. [客户端使用说明](./client.md)
9+
3. [配置JoyQueue](./configurations.md)
10+
4. [Rest API](./rest_api.md)
11+
5. [部署JoyQueue集群](./cluster.md)
1212
6. 确保消息可靠性
1313
7. 性能优化
1414
8. 事务消息

docs/cn/performance.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ SSD | N/A
4040

4141
## 测试方案
4242

43-
场景 | 发送方式 | 批量大小 | 消息压缩方式 | 测试消息大小 | 分区数量
44-
-- | -- | -- | -- | -- | -- | --
45-
**在线业务场景** | 同步 | 1 | 不压缩 | 1KB | 200
46-
**流计算场景** | 异步 | 100 | LZ4 | 1KB | 200
43+
场景 | 发送方式 | 批量大小 | 消息压缩方式 | 测试消息大小 | 分区数量 | 客户端
44+
-- | -- | -- | -- | -- | -- | -- | --
45+
**在线业务场景** | 同步 | 1 | 不压缩 | 1KB | 200 | joyqueue-client-4.1.0
46+
**流计算场景** | 异步 | 100 | LZ4 | 1KB | 200 | kafka-clients-2.1.1
4747

4848
我们在测试过程中采用梯度加压的方式逐步增加消息生产并发,寻找JoyQueue性能的极限。
4949

docs/cn/quickstart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ $ docker run -p 10031:10031 -d --name joy joyqueue/joyqueue-server
121121

122122
现在可以访问管理端: [http://localhost:10031](http://localhost:10031)
123123

124-
* 参考[第4步:创建发布和订阅关系](##第4步:创建发布和订阅关系)
124+
* 参考[第4步:创建发布和订阅关系](#%e7%ac%ac4%e6%ad%a5%e5%88%9b%e5%bb%ba%e4%b8%bb%e9%a2%98%e5%92%8c%e5%8f%91%e5%b8%83%e8%ae%a2%e9%98%85%e5%85%b3%e7%b3%bb)
125125

126-
* 发送和接受消息
126+
* 发送和接收消息
127127

128128
```bash
129129

docs/images/cluster.png

17.5 KB
Loading
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
16+
-->
17+
<project xmlns="http://maven.apache.org/POM/4.0.0"
18+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
20+
<parent>
21+
<artifactId>joyqueue-client</artifactId>
22+
<groupId>com.jd.joyqueue</groupId>
23+
<version>4.1.0-SNAPSHOT</version>
24+
</parent>
25+
<modelVersion>4.0.0</modelVersion>
26+
27+
<artifactId>joyqueue-client-all-shaded</artifactId>
28+
29+
<dependencies>
30+
<dependency>
31+
<groupId>com.jd.joyqueue</groupId>
32+
<artifactId>joyqueue-client-core</artifactId>
33+
</dependency>
34+
<dependency>
35+
<groupId>com.jd.joyqueue</groupId>
36+
<artifactId>joyqueue-client-kafka</artifactId>
37+
</dependency>
38+
<dependency>
39+
<groupId>org.slf4j</groupId>
40+
<artifactId>slf4j-api</artifactId>
41+
</dependency>
42+
</dependencies>
43+
44+
<build>
45+
<resources>
46+
<resource>
47+
<directory>src/main/resources</directory>
48+
<filtering>true</filtering>
49+
</resource>
50+
</resources>
51+
<plugins>
52+
<plugin>
53+
<groupId>org.apache.maven.plugins</groupId>
54+
<artifactId>maven-shade-plugin</artifactId>
55+
<version>3.2.1</version>
56+
<executions>
57+
<execution>
58+
<phase>package</phase>
59+
<goals>
60+
<goal>shade</goal>
61+
</goals>
62+
<configuration>
63+
<minimizeJar>false</minimizeJar>
64+
<artifactSet>
65+
<excludes>
66+
<exclude>org.slf4j:slf4j-api:*</exclude>
67+
</excludes>
68+
</artifactSet>
69+
<relocations>
70+
<relocation>
71+
<pattern>com.codahale</pattern>
72+
<shadedPattern>com.jd.joyqueue.shaded.com.codahale</shadedPattern>
73+
</relocation>
74+
<relocation>
75+
<pattern>org.objectweb.asm</pattern>
76+
<shadedPattern>com.jd.joyqueue.shaded.org.objectweb.asm</shadedPattern>
77+
</relocation>
78+
<relocation>
79+
<pattern>com.google</pattern>
80+
<shadedPattern>com.jd.joyqueue.shaded.com.google</shadedPattern>
81+
</relocation>
82+
<relocation>
83+
<pattern>io.netty</pattern>
84+
<shadedPattern>com.jd.joyqueue.shaded.io.netty</shadedPattern>
85+
</relocation>
86+
<relocation>
87+
<pattern>javax.inject</pattern>
88+
<shadedPattern>com.jd.joyqueue.shaded.javax.inject</shadedPattern>
89+
</relocation>
90+
<relocation>
91+
<pattern>javax.validation</pattern>
92+
<shadedPattern>com.jd.joyqueue.shaded.javax.validation</shadedPattern>
93+
</relocation>
94+
<relocation>
95+
<pattern>org.aopalliance</pattern>
96+
<shadedPattern>com.jd.joyqueue.shaded.org.aopalliance</shadedPattern>
97+
</relocation>
98+
<relocation>
99+
<pattern>org.apache</pattern>
100+
<shadedPattern>com.jd.joyqueue.shaded.org.apache</shadedPattern>
101+
</relocation>
102+
<relocation>
103+
<pattern>org.xerial.snappy</pattern>
104+
<shadedPattern>com.jd.joyqueue.shaded.org.xerial.snappy</shadedPattern>
105+
</relocation>
106+
<relocation>
107+
<pattern>net.jpountz.lz4</pattern>
108+
<shadedPattern>com.jd.joyqueue.shaded.net.jpountz.lz4</shadedPattern>
109+
</relocation>
110+
<relocation>
111+
<pattern>com.jd.laf.extension</pattern>
112+
<shadedPattern>com.jd.joyqueue.shaded.com.jd.laf.extension</shadedPattern>
113+
</relocation>
114+
</relocations>
115+
</configuration>
116+
</execution>
117+
</executions>
118+
</plugin>
119+
</plugins>
120+
</build>
121+
</project>

0 commit comments

Comments
 (0)