flagsmith-java-client icon indicating copy to clipboard operation
flagsmith-java-client copied to clipboard

Fast optimized API for fetching a single flag

Open Dogacel opened this issue 1 year ago • 2 comments

This change basically allows API calls that make minimum required calls to calculate the value of a flag.

Results of benchmark

Benchmark                                      (dataSet)   Mode  Cnt        Score         Error  Units
EvaluationBenchmark.singleFlagLegacy      engineTestData  thrpt    5    96478.239 ±    3882.713  ops/s
EvaluationBenchmark.singleFlagLegacy   engineTestDataBig  thrpt    5     6728.295 ±     206.439  ops/s
EvaluationBenchmark.singleFlagOptimal     engineTestData  thrpt    5   444513.222 ±   15888.499  ops/s
EvaluationBenchmark.singleFlagOptimal  engineTestDataBig  thrpt    5  5004271.701 ± 1647748.621  ops/s

The result is pretty evident on big test data (450 segments, 1000 flags, 1500 rules).

Dogacel avatar Feb 22 '24 01:02 Dogacel

To change,

  • Remove the new optimized environment model and push logic to existing EnvironmentModel.
  • Separate tests for Engine.
  • Tests for the new Flagsmith Client methods.

Dogacel avatar Feb 26 '24 15:02 Dogacel

The concerns should be addressed now (hopefully) 🙏. Let me know if further work is need to be done.

Dogacel avatar Feb 26 '24 19:02 Dogacel