前言

最近开始学习GO的WEB框架,IRIS号称是Go最快的后端Web框架,目前发展最快的Go Web框架。提供完整的MVC功能并且面向未来。
所以先从它开始。

github地址
https://github.com/kataras/iris
文档
https://www.studyiris.com/doc/irisDoc/Installation.html

安装

go get -u github.com/kataras/iris

编辑main.go

package main

   import "github.com/kataras/iris"

   func main() {
app := iris.Default() // Method: GET
// Resource: http://localhost:8080/
app.Handle("GET", "/", func(ctx iris.Context) {
ctx.HTML("Hello world!")
}) // same as app.Handle("GET", "/ping", [...])
// Method: GET
// Resource: http://localhost:8080/ping
app.Get("/ping", func(ctx iris.Context) {
ctx.WriteString("pong")
}) // Method: GET
// Resource: http://localhost:8080/hello
app.Get("/hello", func(ctx iris.Context) {
ctx.JSON(iris.Map{"message": "Hello iris web framework."})
}) // http://localhost:8080
// http://localhost:8080/ping
// http://localhost:8080/hello
app.Run(iris.Addr(":8080"))
}

运行

go run main.go

新打开个窗口执行 
curl http://localhost:8080 
结果 Hello world! 
或在浏览器 访问http://localhost:8080

测试 
现在对它进行简单压力测试 
系统配置 1核 1G内存 , 操作系统:CentOS 7.4 64位

ab -n  -c  http://localhost:8080/
#结果
This is ApacheBench, Version 2.3 <$Revision: $>
Copyright Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient)
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Finished requests Server Software:
Server Hostname: localhost
Server Port: Document Path: /
Document Length: bytes Concurrency Level:
Time taken for tests: 3.102 seconds
Complete requests:
Failed requests:
Write errors:
Total transferred: bytes
HTML transferred: bytes
Requests per second: 3223.45 [#/sec] (mean)
Time per request: 310.227 [ms] (mean)
Time per request: 0.310 [ms] (mean, across all concurrent requests)
Transfer rate: 402.93 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 383.5
Processing: 325.4
Waiting: 325.5
Total: 625.5 Percentage of the requests served within a certain time (ms)
%
%
%
%
%
%
%
%
% (longest request)
05-28 17:16