Adam McKerlie
—Sarah Guthals
—Using libraries like Flagr to help maintain feature flags had a negative performance impact; it was taking 900ms to only check 50 flags.
Using Sentry performance monitoring, we discovered the majority of the time was spent deserializing the Flagr response.
Digging into the client, we noticed that deserialization was turning the entire JSON blob (i.e. the flag results) into a Python object. While deserializing JSON is convenient from a development perspective, because we were only using a few JSON fields, the cost just wasn’t worth it.
After removing caching and patching our own deserializer with a simple json.loads(response.data) we saw a huge improvement in speed — so much so that other areas began to look slow by comparison:
Tasty treats for web developers brought to you by Sentry. Get tips and tricks from Wes Bos and Scott Tolinski.
SEE EPISODESConsidered “not bad” by 4 million developers and more than 100,000 organizations worldwide, Sentry provides code-level observability to many of the world’s best-known companies like Disney, Peloton, Cloudflare, Eventbrite, Slack, Supercell, and Rockstar Games. Each month we process billions of exceptions from the most popular products on the internet.