shotover / shotover-proxy

L7 data-layer proxy
https://docs.shotover.io
Apache License 2.0
82 stars 16 forks source link

Introduce j4rs wrapper to simplify testing java drivers #1682

Closed rukai closed 2 weeks ago

rukai commented 2 weeks ago

The j4rs java interop crate is quite flexible but it allows for a few things which bring us no value:

All of these features were causing great complexity for our java driver integration tests, so I introduced a wrapper that does not expose the above features. It reduces the lines of code used to implement the kafka java driver from 687 to 484. ( 30% reduction in lines) We should expect a similar reduction in complexity for the cassandra java driver. The wrapper completely wraps j4rs and we should not interact directly with j4rs in our driver logic anymore.

The new wrapper consists of 2 types:

While this wrapper is closely matched to our own needs and probably not upstreamable exactly as is. We might be able to see parts of it upstreamed either as an optional wrapper or integrated with the main API. Doing so would reduce the complexity of the wrappers implementation. But no hurry, we can land the wrapper as is for now.

codspeed-hq[bot] commented 2 weeks ago

CodSpeed Performance Report

Merging #1682 will improve performances by 13.12%

Comparing rukai:java_interrop_wrapper (44d5124) with main (f53bf73)

Summary

⚡ 1 improvements ✅ 38 untouched benchmarks

Benchmarks breakdown

Benchmark main rukai:java_interrop_wrapper Change
encode_system.local_result_v5_no_compression 105.5 µs 93.3 µs +13.12%