Skip to content

Commit

Permalink
update content
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhaowin committed Oct 21, 2024
1 parent 75bbc9c commit 1d194d4
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 1 deletion.
5 changes: 4 additions & 1 deletion content/2024-05-12-state-machine.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ https://www.cnblogs.com/StarbucksBoy/p/16888787.html

https://blog.csdn.net/significantfrank/article/details/104996419

https://cloud.benym.cn/pages/2ae430/#%E8%83%8C%E6%99%AF
https://cloud.benym.cn/pages/2ae430/#%E8%83%8C%E6%99%AF


![state-machine](https://image.yuhaowin.com/2024/08/06/175550.PNG)
89 changes: 89 additions & 0 deletions content/2024-08-05-solved-api-slow-problem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
## http 接口偶然响应慢问题排查

apt-get update && apt-get install -y tcpdump hping3 mtr traceroute iputils-ping --no-install-recommends tcpdump hping3 mtr

tcpdump -i eth0 host api.dify.ai -w capture.pcap

kubectl cp crm-qa-12579-7ff6459456-rzzz6:/app/bin/capture.pcap ~/Desktop/crm-qa.pcap


curl --location 'https://api.dify.ai/v1/chat-messages' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer fake-token' \
--data '{
"query": "拉卡拉校园食堂开通分账业务审批填写规范",
"response_mode": "streaming",
"user": "yuhao",
"inputs": {}
}'

https://weiborao.link/docker-traceroute-tcpdump.html

curl -o /dev/null -s -w time_namelookup:"\t"%{time_namelookup}"\n"time_connect:"\t\t"%{time_connect}"\n"time_appconnect:"\t"%{time_appconnect}"\n"time_pretransfer:"\t"%{time_pretransfer}"\n"time_starttransfer:"\t"%{time_starttransfer}"\n"time_total:"\t\t"%{time_total}"\n"time_redirect:"\t\t"%{time_redirect}"\n" --location 'https://api.dify.ai/v1/chat-messages' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer fake-token' \
--data '{
"query": "拉卡拉校园食堂开通分账业务审批填写规范",
"response_mode": "streaming",
"user": "yuhao",
"inputs": {}
}'

tcpdump -i lo port 6310 -w http.pcap

tcpdump -i eth0 host sg-dify.wosai-inc.com -w capture.pcap

tcpdump -i eth0 host api.dify.ai -w capture.pcap


apt-get update && apt-get install -y traceroute iputils-ping --no-install-recommends tcpdump

apt-get install hping3

hping3 -S -p 443 -c 100 api.dify.ai


kubectl cp crm-qa-base-5799dbd479-kjxcv:/app/bin/capture.pcap ~/Desktop/crm-qa-1.pcap



kubectl cp crm-qa-12579-7ff6459456-rzzz6:/opt/jacoco/report/profit-sharing/report.exec ~/Downloads/report.exec

curl --location 'https://api.dify.ai/v1/chat-messages' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer fake-token' \
--data '{
"query": "拉卡拉校园食堂开通分账业务审批填写规范",
"response_mode": "streaming",
"user": "yuhao",
"inputs": {}
}'


curl -w "总时间: %{time_total}s\n名称解析时间: %{time_namelookup}s\n连接时间: %{time_connect}s\nTLS握手时间: %{time_appconnect}s\n等待时间: %{time_starttransfer}s\n数据传输时间: %{time_total}s\nHTTP状态码: %{http_code}\n" -o /dev/null --location 'https://api.dify.ai/v1/chat-messages' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer fake-token' \
--data '{
"query": "拉卡拉校园食堂开通分账业务审批填写规范",
"response_mode": "streaming",
"user": "yuhao",
"inputs": {}
}'



curl -o /dev/null -s -w time_namelookup:"\t"%{time_namelookup}"\n"time_connect:"\t\t"%{time_connect}"\n"time_appconnect:"\t"%{time_appconnect}"\n"time_pretransfer:"\t"%{time_pretransfer}"\n"time_starttransfer:"\t"%{time_starttransfer}"\n"time_total:"\t\t"%{time_total}"\n"time_redirect:"\t\t"%{time_redirect}"\n" --location 'http://sg-dify.wosai-inc.com/v1/chat-messages' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer fake-token' \
--data '{
"query": "拉卡拉校园食堂开通分账业务审批填写规范",
"response_mode": "streaming",
"user": "yuhao",
"inputs": {}
}'



curl -o /dev/null -s -w time_namelookup:"\t"%{time_namelookup}"\n"time_connect:"\t\t"%{time_connect}"\n"time_appconnect:"\t"%{time_appconnect}"\n"time_pretransfer:"\t"%{time_pretransfer}"\n"time_starttransfer:"\t"%{time_starttransfer}"\n"time_total:"\t\t"%{time_total}"\n"time_redirect:"\t\t"%{time_redirect}"\n" --location --request GET 'https://api.dify.ai/v1/datasets?page=1&limit=20' \
--header 'Authorization: Bearer fake-token'

0 comments on commit 1d194d4

Please sign in to comment.