Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance tuning - Write on demand using Pull and remove toUnicastPublisher #8

Merged
merged 3 commits into from
Sep 2, 2020

Conversation

ikhoon
Copy link
Collaborator

@ikhoon ikhoon commented Aug 31, 2020

Motivation:

The conversion between fs2.Stream and Reactive Streams Publisher
is one of the bottlenecks in that benchmark of #4

Modifications:

  • Write on demand instead of Publisher

Result:

  • Before
    Running 30s test @ http://127.0.0.1:8080/hello
      12 threads and 400 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency    11.76ms    2.97ms  86.66ms   89.53%
          Req/Sec     1.71k     0.94k    3.64k    52.50%
      611170 requests in 30.02s, 107.62MB read
      Socket errors: connect 155, read 170, write 0, timeout 0
    Requests/sec:  20358.15
    Transfer/sec:      3.58MB
    
  • After
    Running 30s test @ http://127.0.0.1:8080/http4s/thread
      12 threads and 400 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency     3.77ms    2.41ms 145.85ms   96.60%
        Req/Sec     5.39k     2.88k   59.63k    60.04%
      1932651 requests in 30.10s, 312.64MB read
      Socket errors: connect 155, read 168, write 0, timeout 0
    Requests/sec:  64207.03
    Transfer/sec:     10.39MB
    
    Running 30s test @ http://127.0.0.1:8080/http4s/thread
      12 threads and 400 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency     3.92ms    1.30ms  63.05ms   95.09%
        Req/Sec     5.11k     2.48k   10.36k    61.56%
      1831547 requests in 30.03s, 296.28MB read
      Socket errors: connect 155, read 160, write 0, timeout 0
    Requests/sec:  60989.03
    Transfer/sec:      9.87MBow it will be ignored.
    

…Publisher`

Motivation:

The conversion between `fs2.Stream` and Reactive Streams `Publihser`
is one of the bottlecks in that benchmark of http4s#4

Modifications:

- Write on demand instead of `Publisher`

Result:

- Before
  ```
  Running 30s test @ http://127.0.0.1:8080/hello
    12 threads and 400 connections
    Thread Stats   Avg      Stdev     Max   +/- Stdev
      Latency    11.76ms    2.97ms  86.66ms   89.53%
        Req/Sec     1.71k     0.94k    3.64k    52.50%
    611170 requests in 30.02s, 107.62MB read
    Socket errors: connect 155, read 170, write 0, timeout 0
  Requests/sec:  20358.15
  Transfer/sec:      3.58MB
  ```
- After
  ```
  Running 30s test @ http://127.0.0.1:8080/http4s/thread
    12 threads and 400 connections
    Thread Stats   Avg      Stdev     Max   +/- Stdev
      Latency     3.77ms    2.41ms 145.85ms   96.60%
      Req/Sec     5.39k     2.88k   59.63k    60.04%
    1932651 requests in 30.10s, 312.64MB read
    Socket errors: connect 155, read 168, write 0, timeout 0
  Requests/sec:  64207.03
  Transfer/sec:     10.39MB

  Running 30s test @ http://127.0.0.1:8080/http4s/thread
    12 threads and 400 connections
    Thread Stats   Avg      Stdev     Max   +/- Stdev
      Latency     3.92ms    1.30ms  63.05ms   95.09%
      Req/Sec     5.11k     2.48k   10.36k    61.56%
    1831547 requests in 30.03s, 296.28MB read
    Socket errors: connect 155, read 160, write 0, timeout 0
  Requests/sec:  60989.03
  Transfer/sec:      9.87MBow it will be ignored.
  ```
@ikhoon ikhoon added this to the 0.1.0 milestone Aug 31, 2020
@ikhoon ikhoon merged commit e0b24a6 into http4s:main Sep 2, 2020
@ikhoon ikhoon deleted the performance-tuning branch September 2, 2020 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant