Code Monkey home page Code Monkey logo

Comments (6)

mdakin avatar mdakin commented on September 18, 2024 1

@at15 yes, that was the idea. From documentation for Transport (https://golang.org/src/net/http/transport.go):

// Transports should be reused instead of created as needed.
// Transports are safe for concurrent use by multiple goroutines.

Transport objects are designed to be shared. So, IMO it makes sense to create a single transport object, set a reasonably high MaxIdleConnsPerHost if c is too big and and share it between workers (The default is 100). In my tests this had no performance penalty.

I don't see much benefit of creating a transport per worker. I am not sure why @rakyll chose to do it that way, but maybe there is something I overlooked.

from hey.

mdakin avatar mdakin commented on September 18, 2024 1

I think this is fixed now. Please reopen if you see the same behavior.

from hey.

at15 avatar at15 commented on September 18, 2024

some error are connect: cannot assign requested address, found a similar problem here , change MaxIdleConnsPerHost may work, both hey and the server should be reusing connection by default.

Also I tried hey -n 16384 -c 16384 "http://127.0.0.1:8081/health" on my PC. without changing ulimit the only error I got is socket: too many open files, after ulimit -n 4096, the error reduced a lot

⇒  hey -n 16384 -c 4096 "http://127.0.0.1:8000"
14596 requests done.
16380 requests done.
All requests done.

Summary:
  Total:    5.5077 secs
  Slowest:  5.3914 secs
  Fastest:  0.0000 secs
  Average:  0.0894 secs
  Requests/sec: 2971.8209
  Total data:   294624 bytes
  Size/request: 18 bytes

Status code distribution:
  [200] 16368 responses

Response time histogram:
  0.000 [1] |
  0.539 [15920] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  1.078 [358]   |∎
  1.617 [88]    |
  2.157 [0] |
  2.696 [0] |
  3.235 [0] |
  3.774 [0] |
  4.313 [0] |
  4.852 [0] |
  5.391 [1] |

Latency distribution:
  10% in 0.0020 secs
  25% in 0.0105 secs
  50% in 0.0392 secs
  75% in 0.0737 secs
  90% in 0.1951 secs
  95% in 0.2456 secs
  99% in 1.0030 secs

Error distribution:
  [16]  Get http://127.0.0.1:8000: dial tcp 127.0.0.1:8000: socket: too many open files

I am using a desktop PC with Ubuntu 16.04 and Go1.7

from hey.

mdakin avatar mdakin commented on September 18, 2024

I had a PR that could help this in old project: rakyll/boom#112

Currently hey creates a client with 2 idle channels per worker. If it uses a single client with C idle channels (or some high enough maximum if C is too high) it probably helps the situation.

I don't have my setup for go / hey now, feel free to test the PR and see if it works.

from hey.

at15 avatar at15 commented on September 18, 2024

@mdakin so your PR let all workers share one client and set MaxIdleConnsPerHost: b.C would make the client keep b.C connections like a pool, so the problem of running out of port can be avoided. Is my understanding correct?

btw: some other benchmark tools seems to be creating new client for each worker like hey does ie: go-wrk

from hey.

mdakin avatar mdakin commented on September 18, 2024

A small correction, default for MaxIdleConnsPerHost is 2, MaxIdleConns is 100.

from hey.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.