Implementation and analysis of time wheel and time wheel in go zero

Time wheelUsed to delay the scheduling of tasks.sceneImagine a scenario where I need to maintain a connection pool. The connection in the connection pool has a timeout time. The connection will maintain a certain frequency to send heartbeat packets. For example, it will expire in 5s if I don't receive keep alive within 30s. conn will disconnect ...

Added by cavedave on Sat, 19 Feb 2022 17:38:08 +0200

HTTP traffic artifact Goreplay core source code details

Abstract: Goreplay, formerly known as Gor, is a simple TCP/HTTP traffic recording and playback tool, which is mainly written in Go language. This article is shared from Huawei cloud community< Analysis of goreplay core source code of traffic playback tool >, author: zuozewei. 1, Foreword Goreplay, formerly known as Gor, is a simple ...

Added by tommy445 on Sat, 19 Feb 2022 04:41:45 +0200

Go language Web framework guide

brief introduction wego is a high-performance Web framework written in Go language, which can be used to quickly develop various applications such as RESTful services and back-end services. wego framework is a complete MVC framework, including routing module, database ORM module, view template processing and Session module. wego has the charac ...

Added by Horizon88 on Fri, 18 Feb 2022 18:45:24 +0200

Design of API framework for modular development based on Gin

1, Introduction to gin project The gin framework is very simple for people who write go language. It is a bit similar to the flash framework in python. You need to find a third-party package for everything, and then create a directory structure according to your own experience. For people without project experience, it is really not as good as ...

Added by alpinec on Fri, 18 Feb 2022 14:08:56 +0200

Golang has a precision problem when dealing with floating-point numbers. If you don't use decimal, you will have a big problem

Accuracy problems encountered by Golang in dealing with floating point numbers Golang easy learning 1, What is a floating point number? Floating point number is a digital representation of the number belonging to a special subset of rational numbers. It is used to approximately represent any real number in the computer. Floating poi ...

Added by sureshmaharana on Thu, 17 Feb 2022 22:04:08 +0200

Go Kratos framework mall micro service actual user service API

Go Kratos framework mall micro service actual user service (5) This article is mainly about the preparation of services that provide http interfaces to the web. You can see where you don't write clearly Source code , you are welcome to give advice. Note: vertical... Code is omitted. In order to keep the article concise, I will use vertical fo ...

Added by PeeJay on Thu, 17 Feb 2022 11:33:39 +0200

Go Web Learning - standard library net/http usage

Implement a simple http service package main import ( "fmt" "log" "net/http" ) func main() { http.HandleFunc("/", func(rw http.ResponseWriter, r *http.Request) { fmt.Fprint(rw, "hello word") }) log.Fatal(http.ListenAndServe(":9777", nil)) } Principle analysis:In the first line of the main() function, we use ...

Added by burntheblobs on Thu, 17 Feb 2022 10:52:33 +0200

Golang collaboration and channel usage

brief introductionXie Cheng is a major feature and selling point of golang A coroutine is a lightweight execution thread. You can quickly start a coroutine by using the go keyword to a function or lamba expression The return value of the covariance function is discarded Thread scheduling is managed by the operating system, which is preemptive s ...

Added by Stalingrad on Thu, 17 Feb 2022 04:23:26 +0200

Sorting of top ten sorting algorithms and implementation in Python and golang language [dynamic graph]

Giant shoulders: https://www.cnblogs.com/onepixel/p/7674659.html https://visualgo.net/zh/sorting https://www.runoob.com/w3cnote/merge-sort.html www.cnblogs.com/binarylei/p/12419863.html blog.csdn.net/qq_27124771/article/details/87651495 ○ summary Sorting algorithmprincipleaverageworstspacestabilityBubble sortingAdjacent elements are exchang ...

Added by dsinghldh on Wed, 16 Feb 2022 13:14:10 +0200

A preliminary understanding of map based on Go language

map of Go language foundation The hash relation in the container is used to implement the hash relation. map map is an unordered key value based data structure. map in Go language is a reference type and must be initialized before it can be used. map definition The definition syntax of map in Go language is as follows: map[KeyType]ValueTy ...

Added by sgaron on Wed, 16 Feb 2022 09:56:58 +0200