Channel 还是锁?聊聊 Go 里那些好用的并发模式

Posted on 二 07 7月 2026 in Tech • Tagged with Go, concurrency, channel, mutex, goroutine, pattern, backend

做后端的,跟高并发、大流量打交道是家常便饭。分而治之是基本思想,多进程、多线程、多路复用、异步是基本手段。到了 Go 这里,最常被问的一个问题是:面对资源竞争,到底该用 Channel 还是互斥锁?这篇给一个能记住的判断口诀,再把 Go 里几种真正好用的并发模式一个个拆开讲——附可跑的代码和一张选型清单。


Continue reading

边车模式的协议设计

Posted on 六 22 3月 2025 in Tech • Tagged with Go, pattern

| Abstract | 边车模式的协议设计 | | --------------|------------------------| | Authors | Walter Fan | | Category  | learning note  | | Status | v1...


Continue reading

边车模式:主程序的最佳拍档

Posted on 六 01 3月 2025 in Method • Tagged with pattern, blog

| Abstract | 边车模式:主程序的最佳拍档 | | --------------|------------------------| | Authors | Walter Fan | | Category  | learning note  | | Status...


Continue reading

Spring Security 中设计模式的运用

Posted on 六 01 2月 2025 in Method • Tagged with pattern, blog

| Abstract | Spring Security 中设计模式的应用 | | --------------|------------------------| | Authors | Walter Fan | | Category  | learning note  | |...


Continue reading

管道模式的妙用

Posted on 二 09 6月 2020 in Tech • Tagged with pattern, tech

GoF 的大作 “设计模式:可重用面向对象软件的基础”是软件工程界中的不朽名著,模式是人们用来讨论问题和解决方案的。 模式记录了那些重复出现的问题,成因和相应的解决方案。


Continue reading