• Create optimized go image files and stepped pits


    It is not difficult to create a go image file on docker, but the created file is very large, close to 1g, which is not convenient to use. One of the main problems of docker image is how to optimize and create a small image. We can create docker image files with multi-level construction method, […]

  • Etcd common operation introduction


    install The easiest way to install is to download the pre compiled binary directly from the release page of etcd GitHub. Etcd officially provides different binary files for each system for developers to download according to their own system. Download address: https://github.com/etcd-io/et After the download and decompression, there are two binaries in the directory,etcdas well […]

  • On the principle of golang slice


    Slice introduction The length of an array cannot be modified again after it has been defined; an array is a value type and each pass will produce a copy. Obviously, this data structure can not fully meet the real needs of developers. When we initially define an array, we don’t know how large it needs […]

  • Go sync.map implementation


    Golang map is non goroutine security. If more than one goroutine uses map, it needs to be locked. However, in the high concurrency scenario, lock contention will cause the performance degradation of the system. To solve this problem, go 1.9 provides thread safety: sync.map. Sync.map introduces two data structures, read and dirty, to store data. […]

  • Addition, deletion and insertion of slices in golang slice operation


    This paper introduces the addition, deletion and insertion of slices in the operation of golang slice, and shares the details as follows: 1、 General operation 1. Declare variable, go is automatically initialized to nil, length: 0, address: 0, nil func main(){ var ss []string; fmt.Printf(“length:%v \taddr:%p \tisnil:%v”,len(ss),ss, ss==nil) } — Running… length:0 addr:0x0 isnil:true Success: […]

  • Two minutes for you to understand how to inherit in go


    Recently, when refactoring code, a large number of interfaces have been abstracted. We also use these abstract interfaces to do a lot of pseudo inheritance operations, which greatly reduces code redundancy and increases code readability. Then I searched the articles about go inheritance casually, and found that some articles have too much code, and the […]

  • Overview of net / RPC package in golang (summary)


    RPC, or remote procedure call, is to call a service on a remote computer as if it were a local service.My project is based on restful microservice architecture. With the communication between microservices becoming more and more frequent, more and more system resources are consumed. So I hope that I can use RPC for internal […]

  • Time series database influxdb (I)


    Related articles:Time series database influxdb (I)Time series database influxdb (2)Time series database influxdb (3)Time series database influxdb (4)Time series database influxdb (5)Time series database influxdb (6) There are many kinds of databases, such as traditional RDBMS (such as MySQL), NoSQL (such as mongodb), key value (such as redis), wide column (such as HBase) and so […]

  • Use AWS SQS as buffer queue (go)


    background As a newcomer, the first task involved in the project is to add message queues for the storage of operation records. Why should we do this? The reasons are as follows: in the existing system, we directly add the user ‘s operation records to the mongodb database, but when the peak value of our […]

  • Go notes the ides of go


    After a series of work, go language environment has been built. We also have a preliminary experience of most of the commands provided by go. But before the official development, there is still work to be done, that is, to choose an IDE that suits you. Why use IDE “Why programmers use ide”, in some […]

  • Depth analysis of interface interface in golang


    I. interface introduction If gorountine and channel are the cornerstones to support the concurrency model of go language, and make go language become a beautiful landscape in the era of clustering and multi-core, then interface is the cornerstones of the whole type series of go language, making go language reach an unprecedented height in the […]

  • Time series database influxdb (2)


    Related articles:Time series database influxdb (I)Time series database influxdb (2)Time series database influxdb (3)Time series database influxdb (4)Time series database influxdb (5)Time series database influxdb (6) RP Let’s review the RP policy, which consists of three parts: Duration: the retention time of data. Replication: the number of copies of data in cluster mode. Single node […]