f 格物致知

All Posts

Benchmark in Go

This article describes the Benchmark tool, including its testing principles and some relatively complex test implementations.

Limit docker container cpu memory and other resource usage

In the usual local running some high resource consumption of the container, you may sometimes be unhappy with a container on the machine to make the card can not be, this time you want to shut down the container, but there can not shut down, I do not know if you have this trouble, at least I have, so here is how to limit the Docker container resource consumption.

Note for effective go

Although it's not the first time I read Effective Go, it's also very rewarding to read it again. I didn't record some reading feelings and records in my previous readings, so I can't miss this opportunity this time. At the end, I also read a handful of Thanos' coding guide, and also made up some.

CSRF security defense in front and back-end separation scenarios

In recent years, we have been doing front-end and back-end projects, and recently wrote a little bit of front-end code, using the restful style of front-end and back-end separation, but when asked about security issues during the review, we found that we had not considered this aspect, so here we will think about how to prevent CSRF and XSS, two common network attacks in the restful API scenario of front-end and back-end separation.

API performance test tool: wrk

Before learning about wrk, my understanding of performance testing had been limited to ab (Apache Benchmark). I had the impression that the functionality of ab was relatively simple, that is, simply pressure testing a given API and then seeing how much concurrency was there. So I learned about it, and then I saw that other people were interested in wrk, so I recorded something about wrk in the meantime.

Why stress can not make cpu so busy

Today, I want to try to reproduce a problem, the need to achieve an effect is to fill the CPU, creating a very high load, my first idea is to use stress, the results found that actually have not been able to play, can only play half (50%) to the top, so explore what the problem, by the way, for the record

Debug Docker No Logging Showing In Docker Logs

Recently, when trying a project, I found that the business was not normal, and then I wanted to see what errors were output from the logs in the Docker Container, and then I actually did not see any logs, so I positioned them in passing and simply made a record.

Comparison of the Go package management tool: dep vs go module

Recently, I migrated some of the project's dependency management tools from dep to go module, and there are some cool places and some unpleasant places, so here's a brief introduction to some of my personal views and feelings about the migration process.

How http2 build connection

In one of my previous articles: Handling GRPC Go Connection Handshake Issues, I described a problem I encountered with I described a Go GRPC problem I encountered and how it was eventually solved, and finally left myself a pitfall: how the http2 connection was established. Here’s how to fill that hole.

GRPC Go Connection Handshake Problem Solution

The services in our group provide both GRPC and HTTP interfaces, and most of the HTTP interfaces are directly converted from GRPC via grpc-gateway. Here is a brief description of the root cause and the solution.