![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
go
yyyzhhhhh
123
展开
-
GMP模型
https://zhuanlan.zhihu.com/p/168610624转载 2020-09-04 17:12:56 · 382 阅读 · 0 评论 -
kafka、k8s、GMP模型
kafka:https://zhuanlan.zhihu.com/p/68052232k8s:https://zhuanlan.zhihu.com/p/53260098https://zhuanlan.zhihu.com/p/97605697GMP:https://www.zhihu.com/question/20862617/answer/921061289转载 2020-08-10 13:18:44 · 157 阅读 · 0 评论 -
Go GC 写屏障
1.插入屏障:A指向B,将B标记为灰色注意:栈区B不会被标为灰色,堆区才会缺点:标记完需要STW,扫描栈区重新标记2.删除屏障:A不在指向B,将B标记为灰色注意:栈区B不会被标记为灰色,堆区才会缺点:B可能不会被清除,只能等待下一次gc;开始时需要STW3.混合屏障...原创 2020-08-10 13:12:47 · 696 阅读 · 0 评论 -
Go中的协作式抢占
当某个goroutine执行过久时,sysmon协程会对该goroutine进行标记,该goroutine每次在执行函数前检查该标记,若有标记就让出cpu,但是有一个漏洞,若永远不执行函数,那么该协程就永远不退出,比如只执行for{}...原创 2020-08-09 16:45:22 · 249 阅读 · 0 评论 -
protobuf编码
https://www.jianshu.com/p/73c9ed3a4877转载 2020-08-08 22:09:03 · 92 阅读 · 0 评论 -
etcd的安装和使用
点击这里转载 2020-06-29 11:17:31 · 357 阅读 · 0 评论 -
go依赖注入的使用(dig和facebook inject)
介绍:https://blog.drewolson.org/dependency-injection-in-go用法:https://www.dazhuanlan.com/2019/10/01/5d927074b5dd9/转载 2020-06-24 21:08:46 · 1128 阅读 · 0 评论 -
go操作mysql
点击这里转载 2020-06-18 20:10:13 · 132 阅读 · 0 评论 -
curl操作
点击这里转载 2020-06-18 20:07:03 · 109 阅读 · 0 评论 -
go使用html/template包进行渲染html模板
点击这里转载 2020-06-16 16:20:10 · 2050 阅读 · 0 评论 -
go 文件操作
路径操作(path/filepath):https://www.cnblogs.com/wanghui-garcia/p/10308709.html转载 2020-06-12 11:05:51 · 140 阅读 · 0 评论 -
为什么go文件服务器中要加入http.StripPrefix
例子:http.Handle("/tmpfiles/", http.StripPrefix("/tmpfiles/", http.FileServer(http.Dir("/tmp"))))当访问localhost:xxxx/tmpfiles时,会路由到fileserver进行处理当访问URL为/tmpfiles/example.txt时,fileserver会将/tmp与URL进行拼接,得到/tmp/tmpfiles/example.txt,而实际上example.txt的地址是/tmp/exam原创 2020-06-11 17:11:38 · 1069 阅读 · 0 评论 -
一个不错的go专栏
https://blog.csdn.net/qq_34777600/category_9276749.html转载 2020-06-11 15:46:26 · 122 阅读 · 0 评论 -
go中的匿名变量
在结构体B中使用匿名成员A,相当于在B中定义了A的所有变量和函数type A struct{ dataA int}func (this *A)foo(){ fmt.Print("i am A")}type B struct { A}//============//实际上相当于type B struct{ dataA int}func (this *B)foo(){ fmt.Print("i am A")}//============//那么在使用时直接使用A中原创 2020-06-10 11:24:48 · 261 阅读 · 0 评论 -
go文件操作大全
https://www.cnblogs.com/craneboos/p/9849714.html转载 2020-06-10 10:54:10 · 127 阅读 · 0 评论 -
goroutine原理(C语言表示)
1、能够在单一的系统线程中模拟多个任务的并发执行。2、在一个特定的时间,只有一个任务在运行,即并非真正地并行。3、被动的任务调度方式,即任务没有主动抢占时间片的说法。当一个任务正在执行时,外 部没有办法中止它。要进行任务切换,只能通过由该任务自身调用yield()来主动出让 CPU使用权。4、每个协程都有自己的堆栈和局部变量。每个协程都包含3种运行状态:挂起、运行和停止。停止通常表示该协程已经执行完成(包 括遇到问题后明确退出执行的情况),挂起则表示该协程尚未执行完成,但出让了时间片,以后 有机会时原创 2020-06-09 18:30:59 · 383 阅读 · 0 评论