當服務擴增到一定的程度時,併發時候,因為 zipkin 預設 是靠 http 去做傳輸,所以怕 耗到這部份的效能,所以可以先把 log 發送到 rabbitmq 佇列裡等待被派送到 我們的 zipkin server
因為 rabbitmq 有重送機制或直到任務成功為止這功能,在任務未完成的時候可以送到依 server 能力 慢慢讓我們的 server 去消化這一大堆的 log,好吧開始。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit-test</artifactId>
<scope>test</scope>
</dependency>
provider,consumer,zuul 這些地方有想用 zipkin 的地方都要加上
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
spring:
application:
name: feign-consumer
zipkin:
base-url: http://192.168.0.146:9411
sender:
type: rabbit
rabbitmq:
addresses: 192.168.0.146:5672
password: test
username: test
queue: zipkin
feign:
hystrix:
enabled: true
server:
port: 9001
https://x8795278.blogspot.com/2019/08/websocket-rabbitmq.html
上次玩到一半這邊是安裝還要加上
sudo vim /etc/rabbitmq/rabbitmq.config
允許遠端訪問
[
{rabbit, [{tcp_listeners, [5672]}, {loopback_users, ["test"]}]}
].
sudo systemctl start rabbitmq-server
java -jar zipkin.jar --zipkin.collector.rabbitmq.addresses=localhost
在執行可以先去消耗
也就是去觸發 我們的 provider
訊息會被 cache 在 我們的 rabbitmq
服務啟動後
然後springtool 好Lag我把它移到 vscode了
還沒加其他數據每秒大概可以處理500次 反應時間136ms(吧?
http://localhost:9000/feign-consumer/hello/1/12?token=Bearer%20eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1Nzc3NzE5OTcsInVzZXJuYW1lIjoiamFjayJ9.-2DWFi3MbbuilGvl0B6jVnmb6TzIWQ_FbH0X2hF1XOU
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing