Will
Will

Reputation: 271

How much memory should a Ruby on Rails application consume?

My Ruby on Rails application is consuming around 129 MB of memory.. is this normal?

I have around 3,000 unique visitors a day, i have no complex queries...

My users table has about 18k rows.

Upvotes: 6

Views: 9743

Answers (2)

Dennis Collective
Dennis Collective

Reputation: 193

129MB doesn't seem too excessive to me. What I find more important: does that number grow over time?

If it does, the problem is probably how much of your data set you are loading into memory on a request.

Check out this blog post.

In brief: instantiating too many active record objects is a place where Rails app's memory footprint really grows.

If, in a request, you were to iterate over all 18k users for some reason, and worse, iterate over all of their posts (or whatever associations you have), you'd be instantiating a ton of objects, which (should) get cleared after the request, but Ruby doesn't give the memory back to the system after it has been allocated.

Upvotes: 4

user357936
user357936

Reputation:

I've seen rails applications go as high as 500mb. I'm pretty sure larger ones exist. Unique visitors and database queries are not the cause of memory usage. It's the expensive and large in-memory computations in Ruby.

Try AB testing some of those methods and see how high your memory usage gets. That might solve some memory issues.

Upvotes: 0

Related Questions