Understand isolation level
28 April 2019
Isolation is the
I in ACID, one of the 4 famous properties in database transaction.
Isolation level play a critial role in concurrent scenarios. Higher isolation level offers better gurantee of data consistency, however worse performance in concurrency.... Read More
Golang compiler optimization when covert bool to int
25 August 2017
In golang, you can’t directly compare bool value and int value, and you can’t print bool value as digit 1 or 0 using fmt.Printf(). the best way is to convert bool variable to int.
How to do that? A most common way is to write a conversion function like this one.... Read More
[code analysis] Nginx zero downtime upgrade
23 January 2017
Nginx can gracefully upgrade without shutdown the existing server. Detail upgrade process can be found at the nginx document
- Build a new nginx binary, move it to
- Send a USR2 signal to existing nginx process, the this process will execute new binary, the new binary will accept requests with the old one simultaneously.
- If nothing wrong, send WINCH(optional) and QUIT signal to stop old process.
Brief Note of Docker
27 August 2015
Route All Network Traffic Through VPN
11 August 2015
By default, openvpn traffic only local network traffic through vpn. We can config openvpn client to route all ipv4 traffic through vpn, such as the advanced option in
tunnelblick. However, some other vpn clients like zerotier, whose client is not sound enough, thus we have to route these traffic manually.
Rename Directory Which Contains Submodules
28 July 2015
When rename a directory which contains submodule using command
git mv old new, and then check status with
git status, an error will occur like
fatal: Could not chdir to ‘../../../../../lib/hiredis’: No such file or directory fatal: ‘git status –porcelain’ failed in submodule lib/hiredis
because git won’t rename the path of submodule in the configuration files automatically. Thus we must edit these configs manually.... Read More
Various OpenVPN Clients Configuration
20 July 2015
*.crt Client certificate
*.key Client private key
*.takey OpenVPN TLS auth key
ca.crt CA root certificate
Server ip & port
Encryption Cipher Method,
Hash Algorithm, default
Roman Numberal and Cpp Implementation
15 July 2015
Full Guide: Automatically install Linux by network
14 July 2015
The installation is based on a debian jessie (server) with two network interface. eth0(192.168.100.2) connects to internet, eth1(10.10.10.2) for intranet configured for with fai server.
Firstly, configure fai server with a static ip, edit