URL: https://last9.io/blog/prometheus-vs-victoriametrics/?ref=dailydev
对比了 Prometheus 和 VM 的区别
考虑到和云原生的环境的兼容性,那 Prometheus 可能更合适些,毕竟是 CNCF 组织下的项目。 但如果考虑到性能、存储、资源占用性,VM 会更合适一些。
URL: https://rust-trends.com/newsletter/rust-in-action-10-project-ideas-to-elevate-your-skills/?ref=dailydev
这是一个 Rust 的 newsletter,介绍了十个项目 idea 可以提高你的 Rust 的水平,我看了下这些项目也不怎么限制语言,任何语言都可以尝试下。
简易版的 grep 命令
简单:读取文件根据搜索条件输出搜索结果,涉及到的技术栈:短域名服务
中等:接收一个长域名,转换为一个短域名,访问短域名时可以自动重定向到长域名。基于文本的冒险游戏
中等:用户可以探索房间,选择物品,解密等。基本的网络爬虫
简单:爬取一个网页然后提取指定的信息。实时聊天应用
中等:支持多个人用户加入房间,可以给每个人发送消息。Markdown 解析为 HTML
中等:简单的 HTTP 服务
中等:支持静态文件服务器,也可以处理 RESTful 请求。URL: https://itnext.io/bloom-filters-and-go-1d5ac62557de
多年前我也用 Java 写过一个布隆过滤器,本文作者介绍用 Go 来实现,不过原理都差不多。
布隆过滤器有以下特点:
所以基于以上特性就有了下面这些应用场景:
URL: https://betterprogramming.pub/concurrency-with-select-goroutines-and-channels-9786e0c6be3c
使用 select goroutine channel 掌握并发
func quickestApiResponse(functions []*Function) {
var articles []*Article
for _, function := range functions {
function.Run()
}
select {
case googleNewsResponse := <-google:
fmt.Printf("Source: %s\n", googleNewsResponse.Source)
articles = googleNewsResponse.Articles
case freeNewsReponse := <-free:
fmt.Printf("Source: %s\n", freeNewsReponse.Source)
articles = freeNewsReponse.Articles
}
fmt.Printf("Articles %v\n", articles)
}
func main() {
ch := make(chan struct{}, 1)
go func() {
fmt.Println("do something...")
time.Sleep(4*time.Second)
ch<- struct{}{}
}()
select {
case <-ch:
fmt.Println("done")
case <-time.After(3*time.Second):
fmt.Println("timeout")
}
}
ch := make(chan string)
timeout, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
go func() {
time.Sleep(time.Second * 4)
ch <- "done"
}()
select {
case res := <-ch:
fmt.Println(res)
case <-timeout.Done():
fmt.Println("timout", timeout.Err())
}
文章链接: