Linked by Thom Holwerda on Wed 28th Mar 2012 19:22 UTC
General Development "Today marks a major milestone in the development of the Go programming language. We're announcing Go version 1, or Go 1 for short, which defines a language and a set of core libraries to provide a stable foundation for creating reliable products, projects, and publications. Go 1 is the first release of Go that is available in supported binary distributions. They are available for Linux, FreeBSD, Mac OS X and, we are thrilled to announce, Windows."
Permalink for comment 512521
To read all comments associated with this story, please click here.
RE[7]: Too bad it is so slow
by voidlogic on Fri 30th Mar 2012 23:47 UTC in reply to "RE[6]: Too bad it is so slow"
voidlogic
Member since:
2005-09-03

Your posted program would get 6-8k per run on my machine with ab -k -n 200000 -c 800 http://localhost:8080/

The below program gets 60,000+ RPS on my machine, changes:
* Set max procs dynamicaly
* Stopped net/http go from getting and sending the time with every request
* used fprint rather than fprintf (faster)

package main

import (
"fmt"
"net/http"
"strconv"
"runtime"
)

const hellostr = "HelloWorld"
var hellolen string = strconv.Itoa(len(hellostr))

func handler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain; charset=UTF-8")
w.Header().Set("Content-Length", hellolen) // 2x faster ,from 11k RPS to 22k RPS (requests per second)
w.Header().Set("Date", "")
fmt.Fprint(w, hellostr)
}

func main() {
runtime.GOMAXPROCS(runtime.NumCPU()/2 + 1)
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}

Reply Parent Score: 2