Re: [go-nuts] How to increase concurrent users in net/http

2019-01-14 Thread Matt Ho
Would you mind also posting the network tuning parameters you're using 
along with the os?  I know that when I do perf testing for go on linux, I 
typically need to update a number of tcp related kernel parameters before I 
get meaningful numbers.

M

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] How to increase concurrent users in net/http

2019-01-14 Thread Kasun Vithanage
Sure, will post when i do it. Will open a new thread then :)

On Monday, January 14, 2019 at 7:49:36 PM UTC+5:30, Rodolfo Azevedo wrote:
>
> Please, when you finish your workerpool can you share your code to me? I 
> need to understand this.
>
> Thanks and Regards
>
> Rodolfo Azevedo
>
> Em seg, 14 de jan de 2019 às 10:16, Kasun Vithanage  > escreveu:
>
>> I've deleted original post because it seems a problem with my code, will 
>> try to use a WorkerPool and see the result :) 
>> Thanks for support
>>
>> On Monday, January 14, 2019 at 6:38:27 PM UTC+5:30, Jesper Louis Andersen 
>> wrote:
>>>
>>> This might not be due to Go, but rather due to a resource limit imposed 
>>> by the operating system:
>>>
>>> # 5000. *. (1. -. 0.1954);;
>>> - : float = 4023.
>>>
>>> This is close to 4096, assuming a constant factor of other stuff needing 
>>> resources. Also, as a first step, I'd recommend running your load generator 
>>> on a host separate from the system under test. There are situations in 
>>> which your load generator takes enough resources to mess with the SUT.
>>>
>>> On Mon, Jan 14, 2019 at 12:48 PM Kasun Vithanage  
>>> wrote:
>>>
 I'm doing a simple load test with Apache JMeter. My ambition was to 
 benchmark a go server. Here is the code I've been using, its a simple web 
 server

 package main


 import (
  "fmt"
  "log"
  "net/http"
  "runtime"
 )


 func handler(w http.ResponseWriter, r *http.Request) {
  fmt.Fprintf(w, "welcome")
 }


 func main() {
  runtime.GOMAXPROCS(runtime.NumCPU())
  http.HandleFunc("/function", handler)
  log.Fatal(http.ListenAndServe(":8080", nil))
 }

 When i test the JMeter with 5000 users with Ramp Up Period 1s, Loop 
 Count 1 as stated below

 [image: Screenshot_27.png]

 The result is as follows, it has *around 20% error rate* for the HTTP 
 requests. 

 [image: Screenshot_28.png]

 When i examine the reason for an error JMeter states that the *Connection 
 was refused* by host.

 I would like to know how to increase concurrency in here, at least not 
 dropping the connections in that rate. If the server handler code was bit 
 complex than this, the error rate is increasing to at least 80%.

 I tried the same kind of scenario with Java NIO(
 *com.sun.net.httpserver*). It resulted better as it had a lower error 
 rate. But it caused a high latency when the work is done(Tested with same 
 load).

 -- 
 You received this message because you are subscribed to the Google 
 Groups "golang-nuts" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to golang-nuts...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>> -- 
>>> J.
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] How to increase concurrent users in net/http

2019-01-14 Thread Rodolfo
Please, when you finish your workerpool can you share your code to me? I
need to understand this.

Thanks and Regards

Rodolfo Azevedo

Em seg, 14 de jan de 2019 às 10:16, Kasun Vithanage 
escreveu:

> I've deleted original post because it seems a problem with my code, will
> try to use a WorkerPool and see the result :)
> Thanks for support
>
> On Monday, January 14, 2019 at 6:38:27 PM UTC+5:30, Jesper Louis Andersen
> wrote:
>>
>> This might not be due to Go, but rather due to a resource limit imposed
>> by the operating system:
>>
>> # 5000. *. (1. -. 0.1954);;
>> - : float = 4023.
>>
>> This is close to 4096, assuming a constant factor of other stuff needing
>> resources. Also, as a first step, I'd recommend running your load generator
>> on a host separate from the system under test. There are situations in
>> which your load generator takes enough resources to mess with the SUT.
>>
>> On Mon, Jan 14, 2019 at 12:48 PM Kasun Vithanage 
>> wrote:
>>
>>> I'm doing a simple load test with Apache JMeter. My ambition was to
>>> benchmark a go server. Here is the code I've been using, its a simple web
>>> server
>>>
>>> package main
>>>
>>>
>>> import (
>>>  "fmt"
>>>  "log"
>>>  "net/http"
>>>  "runtime"
>>> )
>>>
>>>
>>> func handler(w http.ResponseWriter, r *http.Request) {
>>>  fmt.Fprintf(w, "welcome")
>>> }
>>>
>>>
>>> func main() {
>>>  runtime.GOMAXPROCS(runtime.NumCPU())
>>>  http.HandleFunc("/function", handler)
>>>  log.Fatal(http.ListenAndServe(":8080", nil))
>>> }
>>>
>>> When i test the JMeter with 5000 users with Ramp Up Period 1s, Loop
>>> Count 1 as stated below
>>>
>>> [image: Screenshot_27.png]
>>>
>>> The result is as follows, it has *around 20% error rate* for the HTTP
>>> requests.
>>>
>>> [image: Screenshot_28.png]
>>>
>>> When i examine the reason for an error JMeter states that the *Connection
>>> was refused* by host.
>>>
>>> I would like to know how to increase concurrency in here, at least not
>>> dropping the connections in that rate. If the server handler code was bit
>>> complex than this, the error rate is increasing to at least 80%.
>>>
>>> I tried the same kind of scenario with Java NIO(*com.sun.net.httpserver*).
>>> It resulted better as it had a lower error rate. But it caused a high
>>> latency when the work is done(Tested with same load).
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "golang-nuts" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to golang-nuts...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> J.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] How to increase concurrent users in net/http

2019-01-14 Thread Kasun Vithanage
I've deleted original post because it seems a problem with my code, will 
try to use a WorkerPool and see the result :) 
Thanks for support

On Monday, January 14, 2019 at 6:38:27 PM UTC+5:30, Jesper Louis Andersen 
wrote:
>
> This might not be due to Go, but rather due to a resource limit imposed by 
> the operating system:
>
> # 5000. *. (1. -. 0.1954);;
> - : float = 4023.
>
> This is close to 4096, assuming a constant factor of other stuff needing 
> resources. Also, as a first step, I'd recommend running your load generator 
> on a host separate from the system under test. There are situations in 
> which your load generator takes enough resources to mess with the SUT.
>
> On Mon, Jan 14, 2019 at 12:48 PM Kasun Vithanage  > wrote:
>
>> I'm doing a simple load test with Apache JMeter. My ambition was to 
>> benchmark a go server. Here is the code I've been using, its a simple web 
>> server
>>
>> package main
>>
>>
>> import (
>>  "fmt"
>>  "log"
>>  "net/http"
>>  "runtime"
>> )
>>
>>
>> func handler(w http.ResponseWriter, r *http.Request) {
>>  fmt.Fprintf(w, "welcome")
>> }
>>
>>
>> func main() {
>>  runtime.GOMAXPROCS(runtime.NumCPU())
>>  http.HandleFunc("/function", handler)
>>  log.Fatal(http.ListenAndServe(":8080", nil))
>> }
>>
>> When i test the JMeter with 5000 users with Ramp Up Period 1s, Loop Count 
>> 1 as stated below
>>
>> [image: Screenshot_27.png]
>>
>> The result is as follows, it has *around 20% error rate* for the HTTP 
>> requests. 
>>
>> [image: Screenshot_28.png]
>>
>> When i examine the reason for an error JMeter states that the *Connection 
>> was refused* by host.
>>
>> I would like to know how to increase concurrency in here, at least not 
>> dropping the connections in that rate. If the server handler code was bit 
>> complex than this, the error rate is increasing to at least 80%.
>>
>> I tried the same kind of scenario with Java NIO(*com.sun.net.httpserver*). 
>> It resulted better as it had a lower error rate. But it caused a high 
>> latency when the work is done(Tested with same load).
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> J.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] How to increase concurrent users in net/http

2019-01-14 Thread Kasun Vithanage
I would also try to test the load on a different host too.

On Monday, January 14, 2019 at 6:38:27 PM UTC+5:30, Jesper Louis Andersen 
wrote:
>
> This might not be due to Go, but rather due to a resource limit imposed by 
> the operating system:
>
> # 5000. *. (1. -. 0.1954);;
> - : float = 4023.
>
> This is close to 4096, assuming a constant factor of other stuff needing 
> resources. Also, as a first step, I'd recommend running your load generator 
> on a host separate from the system under test. There are situations in 
> which your load generator takes enough resources to mess with the SUT.
>
> On Mon, Jan 14, 2019 at 12:48 PM Kasun Vithanage  > wrote:
>
>> I'm doing a simple load test with Apache JMeter. My ambition was to 
>> benchmark a go server. Here is the code I've been using, its a simple web 
>> server
>>
>> package main
>>
>>
>> import (
>>  "fmt"
>>  "log"
>>  "net/http"
>>  "runtime"
>> )
>>
>>
>> func handler(w http.ResponseWriter, r *http.Request) {
>>  fmt.Fprintf(w, "welcome")
>> }
>>
>>
>> func main() {
>>  runtime.GOMAXPROCS(runtime.NumCPU())
>>  http.HandleFunc("/function", handler)
>>  log.Fatal(http.ListenAndServe(":8080", nil))
>> }
>>
>> When i test the JMeter with 5000 users with Ramp Up Period 1s, Loop Count 
>> 1 as stated below
>>
>> [image: Screenshot_27.png]
>>
>> The result is as follows, it has *around 20% error rate* for the HTTP 
>> requests. 
>>
>> [image: Screenshot_28.png]
>>
>> When i examine the reason for an error JMeter states that the *Connection 
>> was refused* by host.
>>
>> I would like to know how to increase concurrency in here, at least not 
>> dropping the connections in that rate. If the server handler code was bit 
>> complex than this, the error rate is increasing to at least 80%.
>>
>> I tried the same kind of scenario with Java NIO(*com.sun.net.httpserver*). 
>> It resulted better as it had a lower error rate. But it caused a high 
>> latency when the work is done(Tested with same load).
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> J.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] How to increase concurrent users in net/http

2019-01-14 Thread Kasun Vithanage
I was wondering about it too, but I see Sun's HTTP Server can handle almost 
every request with even some work load under the same machine. It uses a 
ThreadPool for the task while go uses goroutines.

On Monday, January 14, 2019 at 6:38:27 PM UTC+5:30, Jesper Louis Andersen 
wrote:
>
> This might not be due to Go, but rather due to a resource limit imposed by 
> the operating system:
>
> # 5000. *. (1. -. 0.1954);;
> - : float = 4023.
>
> This is close to 4096, assuming a constant factor of other stuff needing 
> resources. Also, as a first step, I'd recommend running your load generator 
> on a host separate from the system under test. There are situations in 
> which your load generator takes enough resources to mess with the SUT.
>
> On Mon, Jan 14, 2019 at 12:48 PM Kasun Vithanage  > wrote:
>
>> I'm doing a simple load test with Apache JMeter. My ambition was to 
>> benchmark a go server. Here is the code I've been using, its a simple web 
>> server
>>
>> package main
>>
>>
>> import (
>>  "fmt"
>>  "log"
>>  "net/http"
>>  "runtime"
>> )
>>
>>
>> func handler(w http.ResponseWriter, r *http.Request) {
>>  fmt.Fprintf(w, "welcome")
>> }
>>
>>
>> func main() {
>>  runtime.GOMAXPROCS(runtime.NumCPU())
>>  http.HandleFunc("/function", handler)
>>  log.Fatal(http.ListenAndServe(":8080", nil))
>> }
>>
>> When i test the JMeter with 5000 users with Ramp Up Period 1s, Loop Count 
>> 1 as stated below
>>
>> [image: Screenshot_27.png]
>>
>> The result is as follows, it has *around 20% error rate* for the HTTP 
>> requests. 
>>
>> [image: Screenshot_28.png]
>>
>> When i examine the reason for an error JMeter states that the *Connection 
>> was refused* by host.
>>
>> I would like to know how to increase concurrency in here, at least not 
>> dropping the connections in that rate. If the server handler code was bit 
>> complex than this, the error rate is increasing to at least 80%.
>>
>> I tried the same kind of scenario with Java NIO(*com.sun.net.httpserver*). 
>> It resulted better as it had a lower error rate. But it caused a high 
>> latency when the work is done(Tested with same load).
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> J.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] How to increase concurrent users in net/http

2019-01-14 Thread Jesper Louis Andersen
This might not be due to Go, but rather due to a resource limit imposed by
the operating system:

# 5000. *. (1. -. 0.1954);;
- : float = 4023.

This is close to 4096, assuming a constant factor of other stuff needing
resources. Also, as a first step, I'd recommend running your load generator
on a host separate from the system under test. There are situations in
which your load generator takes enough resources to mess with the SUT.

On Mon, Jan 14, 2019 at 12:48 PM Kasun Vithanage 
wrote:

> I'm doing a simple load test with Apache JMeter. My ambition was to
> benchmark a go server. Here is the code I've been using, its a simple web
> server
>
> package main
>
>
> import (
>  "fmt"
>  "log"
>  "net/http"
>  "runtime"
> )
>
>
> func handler(w http.ResponseWriter, r *http.Request) {
>  fmt.Fprintf(w, "welcome")
> }
>
>
> func main() {
>  runtime.GOMAXPROCS(runtime.NumCPU())
>  http.HandleFunc("/function", handler)
>  log.Fatal(http.ListenAndServe(":8080", nil))
> }
>
> When i test the JMeter with 5000 users with Ramp Up Period 1s, Loop Count
> 1 as stated below
>
> [image: Screenshot_27.png]
>
> The result is as follows, it has *around 20% error rate* for the HTTP
> requests.
>
> [image: Screenshot_28.png]
>
> When i examine the reason for an error JMeter states that the *Connection
> was refused* by host.
>
> I would like to know how to increase concurrency in here, at least not
> dropping the connections in that rate. If the server handler code was bit
> complex than this, the error rate is increasing to at least 80%.
>
> I tried the same kind of scenario with Java NIO(*com.sun.net.httpserver*).
> It resulted better as it had a lower error rate. But it caused a high
> latency when the work is done(Tested with same load).
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
J.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] How to increase concurrent users in net/http

2019-01-14 Thread Kasun Vithanage
I'm doing a simple load test with Apache JMeter. My ambition was to 
benchmark a go server. Here is the code I've been using, its a simple web 
server

package main


import (
 "fmt"
 "log"
 "net/http"
 "runtime"
)


func handler(w http.ResponseWriter, r *http.Request) {
 fmt.Fprintf(w, "welcome")
}


func main() {
 runtime.GOMAXPROCS(runtime.NumCPU())
 http.HandleFunc("/function", handler)
 log.Fatal(http.ListenAndServe(":8080", nil))
}

When i test the JMeter with 5000 users with Ramp Up Period 1s, Loop Count 1 
as stated below

[image: Screenshot_27.png]

The result is as follows, it has *around 20% error rate* for the HTTP 
requests. 

[image: Screenshot_28.png]

When i examine the reason for an error JMeter states that the *Connection 
was refused* by host.

I would like to know how to increase concurrency in here, at least not 
dropping the connections in that rate. If the server handler code was bit 
complex than this, the error rate is increasing to at least 80%.

I tried the same kind of scenario with Java NIO(*com.sun.net.httpserver*). 
It resulted better as it had a lower error rate. But it caused a high 
latency when the work is done(Tested with same load).

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.