鸟窝

Trace a package’s journey using Linux tracepoints, perf, and eBPF

Original link: https://colobu.com/2023/09/11/tracing-a-packet-journey-using-linux-tracepoints-perf-ebpf/ Original text: Tracing a packet journey using Linux tracepoints, perf and eBPF I’ve been looking for a low-level Linux network debugging tool for a long time. I’ve been looking for a low-level Linux network debugging tool for a while. Linux allows the use of a combination of virtual interfaces and network namespaces …

Trace a package’s journey using Linux tracepoints, perf, and eBPF Read More »

Singleton pattern and lazy initialization pattern

Original link: https://colobu.com/2023/07/27/go-design-patterns-singleton/ In object-oriented programming languages, the Singleton pattern ensures that a class has only one instance and provides global access to that instance. Then in the Go language, the singleton mode confirms that there is only one instance of a type, and provides global access to the modified instance, usually by directly accessing …

Singleton pattern and lazy initialization pattern Read More »

Real World Go Design Pattern – Factory Pattern

Original link: https://colobu.com/2023/07/24/go-design-patterns-factory/ The factory pattern is a creational pattern, which is a design pattern used to create new objects. The 23 design patterns include the abstract factory pattern, the factory method pattern, and others have also summed up the simple factory pattern. This factory relies heavily on interfaces, abstract classes, and concrete class implementations. …

Real World Go Design Pattern – Factory Pattern Read More »

Replace the map of the standard library to implement SwissTable faster

Original link: https://colobu.com/2023/06/29/replace-std-map-faster/ In the latest weekly meeting of the Go development team, they discussed Google3 re-evaluating the performance of SwissTable, and it may be worth following up to replace the standard library map. SwissTable [MichaelP]: Google3 may want to do some benchmarking on this. Maps are used heavily in google3. This may be of …

Replace the map of the standard library to implement SwissTable faster Read More »

A generic sorted Go Map implementation

Original link: https://colobu.com/2023/06/18/a-generic-sortedmap-in-go/ We know that the built-in map type of Go does not maintain the insertion order of the inserted elements, and it is deliberately set to be random when traversing. Therefore, if we want the map to maintain the insertion order of elements, we need to use a third-party library. Today I will …

A generic sorted Go Map implementation Read More »

High-performance batch read and write network packets Addendum

Original link: https://colobu.com/2023/05/21/batch-read-and-write-udp-packets-in-Go-2/ Some time ago, I wrote an article on high-performance batch reading and writing network packets , which introduced the sendmmsg system call, which can send network packets in batches. Some readers asked what is the difference between this and writev . In fact, look at their definitions, you will know where the …

High-performance batch read and write network packets Addendum Read More »

Several ways to send IP packets using Go

Original link: https://colobu.com/2023/05/13/send-IP-packets-in-Go/ We use net package in the Go standard library, it is easy to send UDP and TCP packets, and develop application layer programs based on them, such as HTTP, RPC and other frameworks and programs, and even we can use the official extension package golang.oef/x/net/iucmp , dedicated to sending and receiving icmp …

Several ways to send IP packets using Go Read More »

ping, when you come back, please tell me the address of the router you passed

Original link: https://colobu.com/2023/05/07/ping-and-record-route/ In the article on using Go to implement the ping tool , we implemented the basic functions of the ping tool ourselves, and we also learned the principle of the underlying implementation of ping. Reader @ZerOne asks a question: Can the function of one-way trace routing be implemented, similar to ping -R …

ping, when you come back, please tell me the address of the router you passed Read More »