# Fixing Discourse performance regressions

DevFeed: [Fixing Discourse performance regressions](<https://devfeed.tech/articles/fixing-discourse-performance-regressions-41339.md>)

Original publisher: [Read original article](<https://samsaffron.com/archive/2015/10/02/fixing-discourse-performance-regressions>)

Author: Sam Saffron

Published: 2015-10-02T07:26:25Z

Content type: tutorial

Language: en

Sources: [Sam Saffron](<https://devfeed.tech/sources/sam-saffron.md>)

Topics: [Development](<https://devfeed.tech/topics/development.md>), [Rails](<https://devfeed.tech/topics/rails.md>), [debugging](<https://devfeed.tech/topics/debugging.md>), [Grafana](<https://devfeed.tech/topics/grafana.md>), [Tooling](<https://devfeed.tech/topics/tooling.md>)

Tags: [debugging](<https://devfeed.tech/tags/debugging.md>), [grafana](<https://devfeed.tech/tags/grafana.md>), [kibana](<https://devfeed.tech/tags/kibana.md>), [performance](<https://devfeed.tech/tags/performance.md>), [performance-tuning](<https://devfeed.tech/tags/performance-tuning.md>), [rails](<https://devfeed.tech/tags/rails.md>), [sql](<https://devfeed.tech/tags/sql.md>)

## AI overview

A Discourse performance regression is used to explain a methodology for performance debugging and optimization. The article recommends prioritizing heavily used foreground routes, monitoring traffic and long-term performance trends, establishing baselines and goals, and using tools such as Kibana, Grafana, rack-mini-profiler, and flamegraphs. It also warns that Rails performance tuning in development mode can produce misleading noise compared with production.

## Source excerpt

Recently, I discovered a performance regression on a very common page on Discourse. I spent a fair amount of time debugging and optimizing. I follow a certain methodology while I do this kind of work. This post is a breakdown on the specific issue I faced with some points you can take back and apply to your next performance debugging session. Pick your fights The first and most important point to take is that you should pick your battles. Discourse has hundreds of routes, however the vast majority of the server cost is incurred by a handful. Pasted image792x576 22 KB The most important 3 routes for us are "topics/show", "list/latest" and "categories/index". They are the heart of the site and lion's share of foreground routes. "topic/timings", "user avatars" and "drafts" are all background routes, we still want to minimize work on them so servers work less hard and we can host more sites, however slowness there is usually not observed by end users. I always try to focus first on the most active foreground routes, those are the spots where I will invest the most amount of effort optimizing. To get a good picture of our traffic patterns we use Kibana. To answer the same question you may use Google Analytics, New Relic or some other tool. Start with a baseline and a goal We have a Grafana dashboard keeping an eye on our 2 most important routes for every site we run. I visit the dashboard regularly to see how performance is on those routes. Is displaying topics getting faster or slower? It is very important to have long term trends so you can isolate when stuff starts playing up. Recently I discovered this: Pasted image971x271 56.7 KB Showing topics on 2 particular sites (one is shown) got much slower. Having this information is golden. This graph is a visible report card on my work towards improving performance. When I see a graph like this my immediate goal becomes restoring old performance characteristics. This is particularly important here since this is our most imp