in the repository. // Change the "C\\mygopath" to your own GOPATH. templatesDir = "C:\\mygopath\\src\\github.com\\kataras\\iris\\_benchmarks\\netcore-mvc-templates\\wwwroot" ) func main() { app := iris.New() app.Configure(configure) app.Controller("/", new(controllers.IndexController)) app.Controller("/about", new(controllers.AboutController)) app.Controller("/contact", new(controllers.ContactController)) app.Run(iris.Addr(":5000"), iris.WithoutVersionChecker) } func configure(app *iris.Application) { app.RegisterView(iris.HTML("./views", ".html").Layout("shared/layout.html")) app.StaticWeb("/public", templatesDir) app.OnAnyErrorCode(onError) } type err struct { Title string Code int } func onError(ctx context.Context) { ctx.ViewData("", err{"Error", ctx.GetStatusCode()}) ctx.View("shared/error.html") } 运行 Go web 办事项目:

- $ cd iris-mvc
- $ go run main.go
- Now listening on: http://localhost:5000
- Application started. Press CTRL+C to shut down.
运行和定位 HTTP 基准对象:
- $ bombardier -c 125 -n 5000000 http://localhost:5000/api/values/5
- Bombarding http://localhost:5000/api/values/5 with 5000000 requests using 125 connections
- 5000000 / 5000000 [======================================================] 100.00% 47s
- Done!
- Statistics Avg Stdev Max
- Reqs/sec 105643.81 7687.79 122564
- Latency 1.18ms 366.55us 22.01ms
推荐阅读
SQL Server 2017正式发布;Oracle宣布开源Fn project
SQL Server 2017 正式宣布:同时支撑 Windows 和 Linux微软在客岁 3 月初次对外宣布了 Linux 版的 SQL Server,痊愈本年 7 月宣布了首个公开 RC 版。前几日在美国奥兰多召开的微软 Ignit>>>详细阅读
本文标题:论HTTP性能,Go与.NET Core一争雌雄
地址:http://www.17bianji.com/lsqh/37756.html
1/2 1