In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to test Asp.net core and golang web". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to test Asp.net core and golang web.
The following is the test environment:
CPU:E3-1230 v2
Memory: 16GB
The computer is a little lame.
Operating system: Centos7.0 (virtual machine single core 2G memory)
Asp.net core rc2
Golang v1.7beta1
Here are their respective codes:
Go
Package main import ("fmt"net/http") func main () {fmt.Println ("This is webserver base!") / / the first parameter is the interface name when the client initiates the http request, and the second parameter is a func, which is responsible for processing the request. Http.HandleFunc ("/ login", loginTask) / / the host address and port number to be listened on by the server err: = http.ListenAndServe ("192.168.199.236loginTask 8081", nil) if err! = nil {fmt.Println ("ListenAndServe error:", err.Error ())}} func loginTask (w http.ResponseWriter, req * http.Request) {/ / get the parameter req.ParseForm () fmt.Fprint (w) passed by the client through GET/POST "Hello World!")
}
C#
Public class MyHandlerMiddleware {/ / Must have constructor with this signature, otherwise exception at runtime public MyHandlerMiddleware (RequestDelegate next) {/ / This is an HTTP Handler, so no need to store next} public async Task Invoke (HttpContext context) {await context.Response.WriteAsync ("Hello World!");} /...} public class Startup {public void ConfigureServices (IServiceCollection services) {} / / This method gets called by the runtime. Use this method to configure the HTTP request pipeline. Public void Configure (IApplicationBuilder app) {app.MapWhen (context = > {return context.Request.Path.ToString () .EndsWith ("jjj.go");}, ap = > {ap.UseMiddleware ();});}}
All are simple routes and simple return strings
From the test results, asp.net core is better, including response time and concurrency. Go is supposed to be faster than. Net core. I hope all of you will do more comparative tests to refute me. This is the result after I have tested N times.
However, in the windows environment, the concurrency of golang can reach about 6000, while the. Net core is still more than 4600, but the response speed of. Net core is still faster than that of golang, which is a bit puzzling to me.
At this point, I believe you have a deeper understanding of "how to test Asp.net core and golang web". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 295
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.