这是一个小小的 web 程序,外观是 blog ,其实已经有论坛的功能,刚开始用 go http 标准库写,后来想用 fasthttp 改写,这时已经超越了blog 程序本身,变成另一种追求。

性能对比

截屏2021-02-09 下午1.53.46

确实牛得一批!!

fasthttp 踩坑

issues

优化

程序优化得比较好,从前端搜索引擎友好到后端性能都有考究。

程序优雅关闭/重启,通过 API 主动将新增内容提交给三大搜索引擎🔍

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2021/02/09 05:48:18 os.Interrupt - shutting down...
2021/02/09 05:48:18 db closed
2021/02/09 05:48:18 gracefully stopped
2021/02/09 05:48:18 youdb Connect to mydata_online.db
2021/02/09 05:48:18 ijd8 Service listening on address :8082
2021/02/09 06:12:19 submit aUrl https://ijd8.com/t/45
2021/02/09 06:12:19 baidu Submit
{"remain":2995,"success":1}
2021/02/09 06:12:19 baidu Submit ok :)
2021/02/09 06:12:19 bing Submit
{"d":null}
2021/02/09 06:12:20 bing Submit ok :)
2021/02/09 06:12:20 google Submit
2021/02/09 06:12:21 {"urlNotificationMetadata":{"latestUpdate":{"notifyTime":"2021-02-09T06:12:21.259472237Z","type":"URL_UPDATED","url":"https://ijd8.com/t/45"},"url":"https://ijd8.com/t/45"}}
2021/02/09 06:12:21 google Submit ok :)
2021/02/09 06:12:21 all submit done https://ijd8.com/t/45

截屏2021-02-09 下午2.13

主要依赖