flipper icon indicating copy to clipboard operation
flipper copied to clipboard

ActiveRecord memoization slowdown

Open amedrz opened this issue 2 years ago • 0 comments

We've been debugging an increase of about 40ms in our Rails application's P95 (prod) after installing flipper and flipper-active_record, even before making any use of it i.e. with an empty DB. The P95 went back to normal after removing flipper-active_record.

Doing some profiling in a local environment, we noticed the overhead might be caused from calls to get_all on every request.

Here's some sampling of 2 consecutive requests:

Request 1

03-24-bmp2n-mcwy9

Request 2

03-25-7wpnr-j7qe2

In the 1st one it seems to do the full DB round, and use ActiveRecord cache in the 2nd. Perhaps that's outside of Flipper's control but I'm also wondering if the Memoizer works at at request level or across many?

Lastly, is the performance penalty we're seeing known and expected?

Thank you

amedrz avatar Aug 03 '22 21:08 amedrz