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

Add StreamMap class for efficient stream-based mapping #768

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Bue-von-hon
Copy link

Motivation:

  • Need a data structure that efficiently handles stream-based key-value mappings
  • Require a solution that can manage sequential data with integer-based indexing
  • Want to leverage the existing ArrayRingBuffer implementation for optimal memory usage

Modifications:

Result:

  • Enables sequential access to stored values using integer keys
  • Maintains O(1) time complexity for basic operations

Motivation:
- Need a data structure that efficiently handles stream-based key-value mappings
- Require a solution that can manage sequential data with integer-based indexing
- Want to leverage the existing ArrayRingBuffer implementation for optimal memory usage

Modifications:
- Add(StreamMap): Added core operations: put(), get(), size(), and remove(). Integrated ArrayRingBuffer as the underlying data structure
- Add(ArrayRingBuffer): Fork from https://gist.github.com/franz1981/6277af990ccfe0a5da8542a75d66ce5e

Result:
- Enables sequential access to stored values using integer keys
- Maintains O(1) time complexity for basic operations
@Bue-von-hon
Copy link
Author

@normanmaurer @tsegismont
I will add the benchmark results when time permits.
In the meantime, I would appreciate if you could review the newly implemented streamMap class.

DefaultHttp2Connection class currently uses IntObjectMap to implement streamMap, which contains Http2Stream objects. Each Http2Stream maintains its state and stream ID.

The streamMap is used in 8 different locations in the code:

  • Adding streams: streamMap.put(stream.id(), stream)
  • Iterating entries: Iterator<PrimitiveEntry> itr = streamMap.entries().iterator()
  • Retrieving streams: streamMap.get(streamId)
  • Checking size: streamMap.size() == 1
  • Removing streams: removed = streamMap.remove(stream.id()) != null

I have implemented a new streamMap class that maintains the same functionality and interface as the original implementation.

@Bue-von-hon
Copy link
Author

Future: HTTP/2 pipelined tests. This would likely be a variant of one of the present-day simple tests (JSON Serialization or Plaintext or both), since the presumed intent of such a test would be to measure the overhead impact/benefit of switching from HTTP v1 to v2.
link

@normanmaurer @tsegismont @franz1981 Hello.
I wanted to conduct HTTP/2 benchmarking, but TechEmpower benchmarks don't support HTTP/2. What would be the best approach?

@Bue-von-hon Bue-von-hon marked this pull request as ready for review December 28, 2024 10:19
@He-Pin
Copy link

He-Pin commented Dec 28, 2024

@Bue-von-hon How about go with gathing?

@Bue-von-hon
Copy link
Author

@Bue-von-hon How about go with gathing?

Oh... I will try it. 👍

@chrisvest
Copy link
Member

This is the QUIC repo, but if you only want to benchmark HTTP/2, we have some microbenchmarks in the main netty repo: https://github.com/netty/netty/tree/4.1/microbench/src/main/java/io/netty/handler/codec/http2

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.

3 participants