MAIF / izanami

Izanami is a centralized versatile feature flag solution, well suited for micro service architectures.
https://maif.github.io/izanami/
Apache License 2.0
184 stars 43 forks source link

Experiment report very slow with millions of events #706

Closed SoerenSilkjaer closed 1 year ago

SoerenSilkjaer commented 1 year ago

Generating an experiment report in the UI is very slow when there are millions of events.

The problem seems to be that the experiment results endpoint is extracting every single event that happened on the experiment, and iterates over them in memory. With just a few thousand experiment events, this becomes a very expensive operation.

First solution that comes to mind is to use the database/store to aggregate the results.

SoerenSilkjaer commented 1 year ago

I can contribute with a pr if we can agree on a solution.

SoerenSilkjaer commented 1 year ago

707

Edit: This pr was closed because it was not the right solution.

pierrebruninmaif commented 1 year ago

Hi @SoerenSilkjaer, i hope to work on this issue next week. But your help is welcome. As you mention, all events are fetching in memory. I also suspect a huge usage of threads, leading some locks.

pierrebruninmaif commented 1 year ago

a fix is released : https://github.com/MAIF/izanami/releases/v1.11.4 Izanami don't load all event into memory any more, the result processing is performed on the PG side. On my laptop with several hundreds of thousands of events, the result is executed in several tens of seconds. The performance remains to be improved with this PG events store of database.