Last active
August 29, 2015 13:57
-
-
Save methane/9849580 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ boom -n 10000 -c 50 http://127.0.0.1:8081/ # Golang | |
10000 / 10000 Boooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo! 100.00 % | |
Summary: | |
Total: 2.4039 secs. | |
Slowest: 0.0376 secs. | |
Fastest: 0.0102 secs. | |
Average: 0.0120 secs. | |
Requests/sec: 4159.9233 | |
Total Data Recieved: 130000 bytes. | |
Response Size per Request: 13 bytes. | |
Status code distribution: | |
[200] 10000 responses | |
Response time histogram: | |
0.010 [1] | | |
0.013 [9228] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎ | |
0.016 [545] |∎∎ | |
0.018 [157] | | |
0.021 [19] | | |
0.024 [0] | | |
0.027 [3] | | |
0.029 [0] | | |
0.032 [0] | | |
0.035 [2] | | |
0.038 [45] | | |
Latency distribution: | |
10% in 0.0109 secs. | |
25% in 0.0113 secs. | |
50% in 0.0117 secs. | |
75% in 0.0122 secs. | |
90% in 0.0128 secs. | |
95% in 0.0132 secs. | |
99% in 0.0177 secs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"net/http" | |
"time" | |
) | |
func Handler(w http.ResponseWriter, r *http.Request) { | |
time.Sleep(10 * time.Millisecond) | |
w.Write([]byte("Hello, World!")) | |
} | |
func main() { | |
http.HandleFunc("/", Handler) | |
log.Fatalln(http.ListenAndServe(":8081", nil)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace wsecho | |
{ | |
class MainClass | |
{ | |
static HttpListener listener; | |
public static void Main(string[] args) | |
{ | |
ThreadPool.SetMaxThreads(100, 100); | |
ThreadPool.SetMinThreads(50, 50); | |
string prefix = "http://+:8081/"; | |
listener = new HttpListener(); | |
listener.Prefixes.Add(prefix); | |
listener.Start(); | |
Console.WriteLine("Listening on: " + prefix); | |
WaitAccept(); | |
while (true) | |
{ | |
Thread.Sleep(1000); | |
} | |
} | |
private static async void WaitAccept() | |
{ | |
while (true) | |
{ | |
var ctx = await listener.GetContextAsync(); | |
Handle(ctx); | |
} | |
} | |
private static async void Handle(HttpListenerContext ctx) | |
{ | |
await Task.Delay(10); | |
ctx.Response.Close(System.Text.ASCIIEncoding.ASCII.GetBytes("Hello, World!"), false); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace wsecho | |
{ | |
class MainClass | |
{ | |
static HttpListener listener; | |
public static void Main(string[] args) | |
{ | |
ThreadPool.SetMaxThreads(100, 100); | |
ThreadPool.SetMinThreads(50, 50); | |
string prefix = "http://+:8081/"; | |
listener = new HttpListener(); | |
listener.Prefixes.Add(prefix); | |
listener.Start(); | |
Console.WriteLine("Listening on: " + prefix); | |
WaitAccept(); | |
while (true) | |
{ | |
Thread.Sleep(1000); | |
} | |
} | |
private static void WaitAccept() | |
{ | |
// Console.WriteLine("WaitAccept: " + Thread.CurrentThread.Name + " - " + Thread.CurrentThread.ManagedThreadId); | |
var task = listener.GetContextAsync(); | |
task.ContinueWith(AsyncAccept); | |
} | |
private static void AsyncAccept(Task<HttpListenerContext> task) | |
{ | |
// Console.WriteLine("AsyncAccept: " + Thread.CurrentThread.Name + " - " + Thread.CurrentThread.ManagedThreadId); | |
WaitAccept(); | |
Handle(task.Result); | |
} | |
private static void Handle(HttpListenerContext ctx) | |
{ | |
// Console.WriteLine("StartHandle: " + Thread.CurrentThread.Name + " - " + Thread.CurrentThread.ManagedThreadId); | |
Thread.Sleep(10); | |
ctx.Response.Close(System.Text.ASCIIEncoding.ASCII.GetBytes("Hello, World!"), false); | |
// Console.WriteLine("EndHandle: " + Thread.CurrentThread.Name); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ boom -n 10000 -c 50 http://127.0.0.1:8081/ | |
10000 / 10000 Boooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo! 100.00 % | |
Summary: | |
Total: 13.1132 secs. | |
Slowest: 1.7285 secs. | |
Fastest: 0.0223 secs. | |
Average: 0.0654 secs. | |
Requests/sec: 762.5904 | |
Total Data Recieved: 130000 bytes. | |
Response Size per Request: 13 bytes. | |
Status code distribution: | |
[200] 10000 responses | |
Response time histogram: | |
0.022 [1] | | |
0.193 [9949] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎ | |
0.364 [0] | | |
0.534 [0] | | |
0.705 [0] | | |
0.875 [0] | | |
1.046 [0] | | |
1.217 [0] | | |
1.387 [0] | | |
1.558 [0] | | |
1.728 [50] | | |
Latency distribution: | |
10% in 0.0364 secs. | |
25% in 0.0482 secs. | |
50% in 0.0592 secs. | |
75% in 0.0656 secs. | |
90% in 0.0713 secs. | |
95% in 0.0758 secs. | |
99% in 0.1323 secs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ boom -n 10000 -c 50 http://127.0.0.1:8081/ | |
10000 / 10000 Boooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo! 100.00 % | |
Summary: | |
Total: 5.0064 secs. | |
Slowest: 1.7185 secs. | |
Fastest: 0.0103 secs. | |
Average: 0.0250 secs. | |
Requests/sec: 1997.4513 | |
Total Data Recieved: 130000 bytes. | |
Response Size per Request: 13 bytes. | |
Status code distribution: | |
[200] 10000 responses | |
Response time histogram: | |
0.010 [1] | | |
0.181 [9949] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎ | |
0.352 [0] | | |
0.523 [0] | | |
0.694 [0] | | |
0.864 [0] | | |
1.035 [0] | | |
1.206 [0] | | |
1.377 [0] | | |
1.548 [0] | | |
1.718 [50] | | |
Latency distribution: | |
10% in 0.0115 secs. | |
25% in 0.0121 secs. | |
50% in 0.0138 secs. | |
75% in 0.0180 secs. | |
90% in 0.0242 secs. | |
95% in 0.0289 secs. | |
99% in 0.1041 secs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ boom -n 10000 -c 50 http://127.0.0.1:8081/ # task wait | |
10000 / 10000 Boooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo! 100.00 % | |
Summary: | |
Total: 6.3635 secs. | |
Slowest: 1.1159 secs. | |
Fastest: 0.0103 secs. | |
Average: 0.0318 secs. | |
Requests/sec: 1571.4659 | |
Total Data Recieved: 130000 bytes. | |
Response Size per Request: 13 bytes. | |
Status code distribution: | |
[200] 10000 responses | |
Response time histogram: | |
0.010 [1] | | |
0.121 [9949] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎ | |
0.231 [0] | | |
0.342 [0] | | |
0.453 [0] | | |
0.563 [0] | | |
0.674 [0] | | |
0.784 [0] | | |
0.895 [0] | | |
1.005 [0] | | |
1.116 [50] | | |
Latency distribution: | |
10% in 0.0119 secs. | |
25% in 0.0143 secs. | |
50% in 0.0251 secs. | |
75% in 0.0360 secs. | |
90% in 0.0455 secs. | |
95% in 0.0500 secs. | |
99% in 0.1064 secs. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment