Here are the slides from my internal talk, which I recently gave for my colleagues.
They are showing the history of optimizing Rails API, starting from AR connections pool and ending by using Fragment caching. Also there is list of tools for profiling applications (stackprof, etc.). All techniques are quite famous.
What we’ve tried
- Connection pool
- Do not load
- Establish DB connection after fork/new thread was created
- Unicorn worker killer
- Postgresql tuning
- Rails 4
- Ruby 2.1.0
- Fragment caching
- Active Model Serializers
- Do not instantiate AR objects
- Try OOBGC - Out-of-Band GC
- Try different web server (e.g. Puma)
If we missed something, please share your ideas in comments.
On the penultimate slide is the title slide of the presentation of Max Lapshin, which briefly tells that to solve certain problems (such as when you need to keep a large number of clients) more appropriate solution might be using another technologies/languages (Erlang in particular).
UPD. Ideas from comments
- Try Conditional Get