SQL isn't a good match for the recursive structure of comments (and our version of mariadb from LTS Ubuntu doesn't support recursive common table expressions), so the app pulls all comments in ActiveRecord objects and threads/sorts them there. It's expensive and uncached. Codebase is here if you're curious:
https://github.com/lobsters/lobstersTraffic counting has to wait until I have spare attention, which is also a shallow resource pool. :)