How does GMP scheduler work

As we know that There is a runtime when Golang running. The runtime perform the scheduled tasks(goroutine) in user space rather than kernel, so it’s more lightweight. It do a better tradeoff between system resource usage and performance, especially in IO tasks. In this article, I’ll show you Golang scheduler’s history, Goroutine scheduler GMP’s design pattern, and some cases how does GMP handle.

Why we need a Scheduler

As we know that There is a runtime when Golang running. The runtime perform the scheduled tasks(goroutine) in user space rather than kernel, so it’s more lightweight. It do a better tradeoff between system resource usage and performance, especially in IO tasks. In this article, I’ll show you Golang scheduler’s history, Goroutine scheduler GMP’s design pattern, and some cases how does GMP handle.

GREP and regex basic

GREP is global regular expression print. It may the most popular tool to find patterns in file and it is always a built-in command in *nix system. We can see it from name that grep can match string from input data with regular expression. In this article, I’ll show you how to use grep and some normal regular expression meanings in daily scenario.

Overall usage of grep

Testing in Golang

Golang has a default command go test to run test code like junit. go test will think of the package as a basic unit. Of course you can specify the source files you run, that filename endswith “_test.go”. And testing function always signed like func TestXXX(t testing.T).

幂等与全局ID

什么是幂等?我们这里所说的幂等是指非主观因素造成了多次相同的请求,而做幂等设计要求这些相同的请求无论是做一次还是多次不产生副作用。即 f...f(f(x))=f(x)。产生多次请求原因有很多比如前端没有做防抖的多次点击提交,MQ消息投递失败重试等。

Java容器类

Java提供的容器类如List、Set、Map是语言的基础,熟练掌握是必备技能,本文就Java中容器相关的坑与知识做一个总结整理。本文涉及的代码摘自OpenJDK jdk9-b94,部分逻辑在不同版本的实现有所差异。

BIO、NIO与AIO

IO是操作系统提供的基础功能,之前介绍了网络Server模型的演进就是基于IO的改进。在语言层面,不同语言对操作系统的IO能力进行了不同的封装与接口的统一,如Java的NIO在linux平台使用的epoll而windows平台使用的iocp,这也是Java作为高级语言层面对操作系统功能统一封装的一个体现。本文结合Java具体代码了解一下什么是BIO、NIO与AIO。

为什么会产生微服务架构

Web应用架构受系统用户量、开发人员组织方式影响严重。过去二十年互联网迅速发展,Web架构也从单体式演进出微服务,背后还有比如 Martin Fowler 提出的理论支撑。虽然每个人都听说过微服务,但是很多人并不太清楚为什么要这么做,应该怎么做,怎么拆。要回答这个问题我认为需要从Web架构的演化历史的高度去理解这些架构设计中的取舍。

再谈Java GC

GC是影响JVM性能的重要因素,不同jvm厂商、版本实现了不同垃圾收集器和算法,各有优缺点。本文就jvm内存划分做进一步补充说明并聊聊各种常见的垃圾收集器,它们的基本算法和使用场景以及一些GC调优的方法。

理解并实现IoC与AOP

IoC(Inversion of Control)与AOP(Aspect Oriented Programming)是java web编程领域领的重要概念。java作为面向对象的强类型静态语言在编程时存在很多局限性,比如对象之间的复杂依赖关系处理,比如运行时获取修改代码meta信息等。本文就聊聊IoC与AOP是什么以及怎样实现。