Gin framework: log configuration management

introduceThrough a complete example, manage logs reasonably in the Gin framework.What are the usage scenarios?Log auto scroll Split into multiple log files Log format modification waitWe will use rk-boot To start the microservices of the Gin framework.Please visit the following address for a complete tutorial:https://rkdocs.netlify.app/cnins ...

Posted by phpPunk on Fri, 26 Nov 2021 11:47:10 -0800

gol memory escape

summaryThe escaped pointer variable itself is also allocated in the heap space, so the function can return the address of the local variable. At this time, the local variable is equivalent to the local pointer variable. When escaping, the pointer variable itself is also allocated in the heap space, so it can return its address.The memory of sta ...

Posted by akaki on Thu, 25 Nov 2021 13:58:49 -0800

gRPC call based on memory communication

Apache Dubbo has the communication mode of injvm, which can avoid the delay caused by the network and does not occupy the local port. It is a more convenient RPC communication mode for testing and local verification.Recently, I saw the code of containerd and found that it has similar requirements. Then I investigated whether gRPC has a similar ...

Posted by LexHammer on Wed, 24 Nov 2021 14:05:22 -0800

zap receives the default log of gin framework

The previous two articles have introduced how to use logs in golang, and zap has been selected as our log framework in many log framework libraries. This article will explain:How to print the request log in combination with the current mainstream Web framework ginEncapsulate zap twice and inject trace information. Once, we can query all the com ...

Posted by Schwalbach on Wed, 24 Nov 2021 00:37:41 -0800

How to deal with sudden traffic peak gracefully in microservice governance

Why do I need to reduce the load In micro service clusters, the call link is perplexing. As a service provider, there is a mechanism to protect itself, which prevents the caller from calling himself down without any brain calls and ensuring the high availability of his services. The most common protection mechanism is the current limiting mecha ...

Posted by ark014 on Mon, 22 Nov 2021 20:32:15 -0800

How to deal with sudden traffic peak gracefully in microservice governance

Why do I need to reduce the loadIn micro service clusters, the call link is perplexing. As a service provider, there is a mechanism to protect itself, which prevents the caller from calling himself down without any brain calls and ensuring the high availability of his services.The most common protection mechanism is the current limiting mechani ...

Posted by buddhika2010 on Mon, 22 Nov 2021 20:18:47 -0800

How to deal with sudden traffic peak gracefully in microservice governance

Why do I need to reduce the load In micro service clusters, the call link is perplexing. As a service provider, there is a mechanism to protect itself, which prevents the caller from calling himself down without any brain calls and ensuring the high availability of his services. The most common protection mechanism is the current limiting mec ...

Posted by wisewood on Mon, 22 Nov 2021 19:09:01 -0800

Potential risks of defer Close() in Golang

As a Gopher, we can easily form a programming convention: whenever there is an object x that implements the io.Closer interface, after getting the object and checking the error, we will immediately use defer X. close() to ensure that the X object is closed when the function returns. Here are two examples of idiomatic writing.HTTP requestresp, e ...

Posted by cdc5205 on Mon, 22 Nov 2021 18:52:21 -0800

Go language core 36 lecture (go language practice and application 10) -- learning notes

32 | context.Context typeIn the last article, we talked about the sync.WaitGroup type: a synchronization tool that can help us implement one to many goroutine collaboration processes.When using the WaitGroup value, we'd better use the standard pattern of "first unified Add, then concurrent Done, and finally Wait" to build the collabor ...

Posted by s_dhumal on Mon, 22 Nov 2021 13:06:01 -0800

[Go Web learning notes] Chapter 12 Go and regular expressions

Hello, everyone. All the following are my notes when I study teacher Han Ru's tutorial. Some contents have been deleted and modified. It is recommended that you read the original author's documents for learning. This article is only used as personal learning notes, and will be continuously modified on this basis in the future. When learning Go ...

Posted by lkq on Mon, 22 Nov 2021 08:34:15 -0800