Object Allocations on the Web
How many objects does a Rails request allocate? Here are Twitter’s numbers:
- API: 22,700 objects per request
- Website: 67,500 objects per request
- Daemons: 27,900 objects per action
I want them to be lower. Overall, we burn 20% of our front-end CPU on garbage collection, which seems high. Each process handles ~29,000 requests before getting killed by the memory limit, and the GC is triggered about every 30 requests.
This is a pretty damn sad state of affairs with respect to Rails when you consider how highly-tuned Twitter must be at this stage of the game.