作家
登录

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

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

 
  • type ContactController struct{ mvc.Controller } 
  • func (c *ContactController) Get() { 
  •     c.Data["Title"] = "Contact" 
  •     c.Data["Message"] = "Your contact page." 
  •     c.Tmpl = "contact.html" 
    1. package models 
    2. // HTTPError a silly structure to keep our error page data. 
    3. type HTTPError struct { 
    4.     Title string 
    5.     Code  int 
    1. package controllers 
    2. import "github.com/kataras/iris/mvc" 
    3. type IndexController struct{ mvc.Controller } 
    4. func (c *IndexController) Get() { 
    5.     c.Data["Title"] = "Home Page" 
    6.     c.Tmpl = "index.html" 
    1. /* 
    2. ../netcore-mvc-templates/wwwroot/css 
    3. ../netcore-mvc-templates/wwwroot/images 
    4. ../netcore-mvc-templates/wwwroot/js 
    5. ../netcore-mvc-templates/wwwroot/lib 
    6. ../netcore-mvc-templates/wwwroot/favicon.ico 
    7. views/shared/layout.html 
    8. views/shared/error.html 
    9. views/about.html 
    10. views/contact.html 
    11. views/index.html 
    12. These files are quite long to be shown in this article but you can view them at:  
    13. https://github.com/kataras/iris/tree/master/_benchmarks/iris-mvc-templates 
    14. */ 

    运行 Go 办事项目:

    运行 HTTP 基准对象:

    1. Bombarding http://localhost:5000 with 1000000 requests using 125 connections 
    2.  1000000 / 1000000 [======================================================] 100.00% 37s 
    3. Done! 
    4. Statistics Avg Stdev Max 
    5.  Reqs/sec 26656.76 1944.73 31188 
    6.  Latency 4.69ms 1.20ms 22.52ms 
    7.  HTTP codes: 
    8.  1xx — 0, 2xx — 1000000, 3xx — 0, 4xx — 0, 5xx — 0 
    9.  others — 0 
    10.  Throughput: 192.51MB/s 
    1. $ cd iris-mvc-templates 
    2. $ go run main.go 
    3. Now listening 

        推荐阅读

        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)