aklivity / zilla

🦎 A multi-protocol edge & service proxy. Seamlessly interface web apps, IoT clients, & microservices to Apache Kafka® via declaratively defined, stateless APIs.
https://docs.aklivity.io/zilla
Other
528 stars 48 forks source link

Integrate OpenJMH for per-binding microbenchmarks #167

Open jfallows opened 1 year ago

jfallows commented 1 year ago

Today we have an OpenJMH microbenchmark BufferBM for the internal ring buffer data structure used by all zilla bindings.

However, this does not measure the code executed in reaction to reading a frame from the ring buffer, such as the dispatch logic in the runtime engine, nor any binding specific code needed to implement a specific protocol decoder for example.

Therefore, we need to provide an integration with OpenJMH that will make it straightforward to write microbenchmarks for each binding, driving frames into the ring buffer (and consuming any reply frames), measuring the performance of each binding in isolation.

As we make performance improvements to the codebase, we should see these benchmarks reflect the improvements, perhaps for a specific binding, or for all bindings if the improvement is made generically in the engine.

In a similar fashion to the integration with k3po, we can implement the integration with OpenJMH in engine test codebase, then reuse that from each binding to run binding-specific microbenchmarks.

We'll need to make decisions on how to define client and server behavior on either side of the binding, how to drive the load, how to record measured performance, and how to report measured performance.

Alfusainey commented 1 year ago

@jfallows I would like to work on this issue. Can you please assign it to me?

Alfusainey commented 1 year ago

@jfallows

In a similar fashion to the integration with k3po, we can implement the integration with OpenJMH in engine test codebase, then reuse that from each binding to run binding-specific microbenchmarks.

In addition to k3po, can we also say that its a (remotely) similar fashion to the idea behind the EngineRule test rule (found in engine test)? I see that the EngineRule is used in various binding and guard-specific integration tests but it is defined in the engine test code base

jfallows commented 1 year ago

@Alfusainey yes that's right, even though the execution environment for JMH micro benchmarks does not use JUnit.