Skip to content

Instantly share code, notes, and snippets.

package main
import (
"container/list"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
package main
import (
"compress/gzip"
"io"
"net/http"
"strings"
)
type gzipResponseWriter struct {
package main
import (
"bufio"
"fmt"
"os"
"time"
)
const numWorkers = 3
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"
package main
import (
"net/http"
)
type SingleHost struct {
handler http.Handler
allowedHost string
}
package main
import (
"fmt"
"reflect"
)
//function types
type mapf func(interface{}) interface{}
package main
import (
"bufio"
"fmt"
"os"
"time"
)
const numWorkers = 3
package main
import (
"code.google.com/p/go.net/websocket"
)
type connection struct {
// The websocket connection.
ws *websocket.Conn

Benchmarking Nginx with Go

Today I just wanted to know which of these options is faster:

  • Go HTTP standalone
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI

Hardware

package main
import (
"container/list"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"