php和go的web性通对比
试用了一个php和go的helloworld的性能对比
纯php index.php <?php echo 'hello world'; ?>
php -S 0.0.0.0:8801
ab -n 100 -c 10 http://127.0.0.1:8801/ # Requests per second: 4000
lumen
php -S 0.0.0.0:8802 -t public
ab -n 100 -c 10 http://127.0.0.1:8802/ # Requests per second: 683.92
配置nginx
ab -n 100 -c 10 http://127.0.0.1:8803/ # Requests per second: 827.40 [#/sec] (mea
安装 go和go的web框架 Beego
go get github.com/astaxie/beego
` // hello.go
package main
import "github.com/astaxie/beego"
func main(){
beego.Run()
}
`
go build hello.go
./hello
ab -n 100 -c 10 http://127.0.0.1:8080/ #Requests per second: 3887.12 [#/sec]