Skip to content

Instantly share code, notes, and snippets.

View liuhangyu's full-sized avatar
🦂
On vacation

rtee+ liuhangyu

🦂
On vacation
View GitHub Profile
@liuhangyu
liuhangyu / libpq-demo.cc
Created October 20, 2022 01:30 — forked from ictlyh/libpq-demo.cc
libpq examples.
/*
* Demo of libpq.
* Build: g++ libpq-demo.cc -o libpq-demo -lpq
* Run: ./libpq-demo
*/
#include <arpa/inet.h>
#include <iostream>
#include <libpq-fe.h>
#include <sstream>

Keybase proof

I hereby claim:

  • I am liuhangyu on github.
  • I am liuhy (https://keybase.io/liuhy) on keybase.
  • I have a public key whose fingerprint is 42B3 8AA7 CF27 A655 073A 5237 1817 6C0C 5B70 8B5E

To claim this, I am signing this object:

@liuhangyu
liuhangyu / golang_job_queue.md
Created September 9, 2017 15:28 — forked from harlow/golang_job_queue.md
Job queues in Golang
@liuhangyu
liuhangyu / benchmark+go+nginx.md
Created August 30, 2017 15:15 — forked from hgfischer/benchmark+go+nginx.md
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI