作家
登录

论HTTP性能,Go与.NET Core一争雌雄

作者: 来源: 2017-10-10 13:48:24 阅读 我要评论

 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 办事项目:

    1. $ cd iris-mvc 
    2. $ go run main.go 
    3. Now listening on: http://localhost:5000 
    4. Application started. Press CTRL+C to shut down. 

    运行和定位 HTTP 基准对象:

    1. $ bombardier -c 125 -n 5000000 http://localhost:5000/api/values/5 
    2. Bombarding http://localhost:5000/api/values/5 with 5000000 requests using 125 connections 
    3.  5000000 / 5000000 [======================================================] 100.00% 47s 
    4. Done! 
    5. Statistics        Avg      Stdev        Max 
    6.   Reqs/sec    105643.81    7687.79     122564 
    7.   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

    关键词: 探索发现

    乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

    网友点评
    自媒体专栏

    评论

    热度

    精彩导读
    栏目ID=71的表不存在(操作类型=0)