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

Allow specialization of the RouterResponder #444

Merged
merged 5 commits into from May 20, 2024

Conversation

Joannis
Copy link
Contributor

@Joannis Joannis commented May 8, 2024

I've ran the PerformanceTest codebase two times, before and after this PR. Note that the PerformanceTest only uses 4 cores for HB2 - so that we have resource budget for regular OS use and the wrk client benckmark suite.

Since I made a lot of symbols inlinable, I had to make them public or internal. Public with SPI does not work with inlinable. We'll need to decide on a public API surface if we want benchmarks.

TODOs:

  • Fix the router benchmarks in the Benchmarks folder.

Before

Running 15s test @ http://localhost:8080
  8 threads and 128 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     1.78ms    1.35ms  47.83ms   91.64%
    Req/Sec     9.80k     1.47k   26.85k    89.11%
  1173503 requests in 15.10s, 166.75MB read
Requests/sec:  77697.81
Transfer/sec:     11.04MB

After

Running 15s test @ http://localhost:8080
  8 threads and 128 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     1.69ms    1.37ms  50.63ms   93.09%
    Req/Sec    10.28k   694.90    13.73k    76.45%
  1233179 requests in 15.10s, 175.23MB read
Requests/sec:  81659.66
Transfer/sec:     11.60MB

@Joannis Joannis requested a review from adam-fowler May 8, 2024 18:00
@Joannis Joannis marked this pull request as draft May 8, 2024 18:00
@Joannis Joannis force-pushed the jo/specialize-router-responder branch from 83b9f5e to 49fe5c8 Compare May 9, 2024 06:32
@Joannis Joannis force-pushed the jo/specialize-router-responder branch from 49fe5c8 to 657aa5a Compare May 9, 2024 06:34
@adam-fowler
Copy link
Member

Can you get the Benchmarks and Tests working again, to indicate what we would need to make public. I guess for the tests it doesn't matter too much as you can import as @testable.

Copy link
Member

@adam-fowler adam-fowler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment above

# Conflicts:
#	Sources/Hummingbird/Router/Trie/Trie+serialize.swift
Base automatically changed from jo/struct-of-arrays to main May 13, 2024 11:49
@Joannis Joannis force-pushed the jo/specialize-router-responder branch from 657aa5a to ee0dce5 Compare May 13, 2024 11:49
@Joannis Joannis marked this pull request as ready for review May 13, 2024 21:48
@Joannis Joannis requested a review from adam-fowler May 13, 2024 21:48
Copy link
Member

@adam-fowler adam-fowler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue, that was inherited from the original array of structs PR

@@ -15,10 +15,12 @@
import HummingbirdCore

/// URI Path Trie Builder
@_spi(Internal) public struct RouterPathTrieBuilder<Value: Sendable> {
@_documentation(visibility: internal)
public struct RouterPathTrieBuilder<Value: Sendable> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't need to be public. It is only ever used to build a router. I'm not sure why the TrieRouter serialize functions have been made @inlineable. They don't need to be. Building a router doesn't need to be optmized., It is only the resolve functions that should be @inlineable. By removing the inlineable on the serialize functions this can be make internal again.

@Joannis Joannis requested a review from adam-fowler May 19, 2024 20:05
Copy link
Member

@adam-fowler adam-fowler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor compile error I fixed, but otherwise looks good

@adam-fowler adam-fowler merged commit aed1e36 into main May 20, 2024
4 of 5 checks passed
@adam-fowler adam-fowler deleted the jo/specialize-router-responder branch May 20, 2024 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants