Skip to content

Instantly share code, notes, and snippets.

View heshed's full-sized avatar
:octocat:
happy serving

BadTimo heshed

:octocat:
happy serving
View GitHub Profile
@heshed
heshed / load_test.sh
Last active December 16, 2015 03:29
funkload test, no sudo power, no network access * funkload * http://funkload.nuxeo.org/ * required packages * gnuplot 4.2 * http://www.gnuplot.info/ * python-virtualenv * http://pypi.python.org/pypi/funkload/ or http://funkload.nuxeo.org/snapshots/ * http://funkload.nuxeo.org/3dparty/ * docutils * webunit * tcpwatch * install no sudo power, no n…
#########################################################
# python funkload 설치 및 데모 시연 스크립트
# HTTP 서버의 response times, throughput
# CPU/Memory/Load/Network 레포팅을 볼 수 있다.
# robot test 또는 jenkins 와 통합이 가능하다.
# author : tech-heshed
# date : 2013.4.5
#########################################################
# Global variables
@heshed
heshed / bincount_of_digitize.py
Created August 8, 2014 14:24
bincount of digitize random floats
#/usr/bin/env python
#-*- coding : utf-8 -*-
'''
Created on 2014. 8. 8.
@author: binaa1@gmail.com
'''
import time
import numpy as np
@heshed
heshed / jenkins.osx
Created December 18, 2014 01:18
OSX jenkins help9
To have launchd start jenkins at login:
ln -sfv /usr/local/opt/jenkins/*.plist ~/Library/LaunchAgents
Then to load jenkins now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
Or, if you don't want/need launchctl, you can just run:
java -jar /usr/local/opt/jenkins/libexec/jenkins.war
@heshed
heshed / .vimrc
Last active August 29, 2015 14:12
.vimrc
" see https://github.com/gmarik/Vundle.vim
set ruler
set hlsearch
set tabstop=4
set shiftwidth=4
syntax on
set nobackup
set bs=2
set history=50
set visualbell t_vb = ""
@heshed
heshed / .zshrc
Last active November 17, 2017 06:48
.zshrc
#
# Executes commands at the start of an interactive session.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
#include <event.h>
#include <evhttp.h>
#include <pthread.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <iostream>
@heshed
heshed / tonardo_middle.py
Created April 23, 2015 02:30
tonardo server
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import signal
import tornado.ioloop
import tornado.web
import tornado.log
import tornado.gen
import tornado.template
@heshed
heshed / .vimrc
Last active August 29, 2015 14:21
.vimrc for vim-plug
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
set ruler
set tabstop=4
set shiftwidth=4
syntax on
set nobackup
set bs=2
set history=50
@heshed
heshed / LineReader.go
Created June 27, 2015 02:14
read next line from file
import (
"bufio"
"os"
)
type Reader struct {
path string
input *os.File
scanner *bufio.Scanner
}

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