I just came across this morning paper blog post from June:: How not to structure your database-backed web applications
This is a fascinating study of the problems people get into when using ORMs to handle persistence concerns in their web applications. The authors study real-world applications and distil a catalogue of common performance anti-patterns. There are a bunch of familiar things in the list, and a few that surprised me with the amount of difference they can make. By fixing many of the issues that they find, Yang et al., are able to quantify how many lines of code it takes to address the issue, and what performance improvement the fix delivers.
Sharing it here because Discourse is one of the applications that they profiled for this paper:
Finding and profiling real-world applications
The study focuses on Ruby on Rails applications, for which many large open source applications: “ compared to other popular ORM frameworks such as Django and Hibernate, Rails has 2x more applications on GitHub with 400 or more stars than Django and Hibernate combined .” Six popular application categories (covering 90% of all Rails apps with more than 100 stars on GitHub) are further selected, and then the two most popular applications in each category. Resulting in the following twelve apps:
I have’t read the actual paper yet, and while I read most of the blog post, I didn’t study it deeply. The only thing that’s jumped out at me so far with regards to Discourse is perhaps an opportunity to replace some
where.first calls with
find_by instead? But I again, I’ve not studied this closely, nor is my Rails knowledge good enough to know whether that claim holds merit.
In any case, I figured folks here would be better qualified to dig deeper if they care to!