Loading 3000 models to Ruby on Rails. Performances?

Hi,

I just wandering. If I autoload 3000 Ruby on Rails classes, will it need
more computer memory? is more rails classes loaded, more memory needed?
will it cause performances problems?

Thanks,
John

Hi John,

More classes and instances will use more memory. Many websites uses
Rails with these 3000+ classes in production, so that’s not really a
problem.

What exactly is your question? You can disable parts of the Rails
framework in your environment.rb, but that won’t make a big
difference.

You may really want to look at a NoSQL option, like MongoDB.

pl wrote:

Hi John,

More classes and instances will use more memory. Many websites uses
Rails with these 3000+ classes in production, so that’s not really a
problem.

What exactly is your question? You can disable parts of the Rails
framework in your environment.rb, but that won’t make a big
difference.

Hi Pl,

Great to know many website use more than 3000+ classes.

Basically,

  1. I will have huge numbers of tables and each one of them have totally
    different columns. This because I want user to be able to upload theirs
    own data/tables.
    So, in this case, it can be even 20000+ classes.

  2. For each tables, I will have model class that will access that table.

  3. By having these no 1 and 2 requirement, I will need to load “model
    classes” dynamically whenever a user import their own table without
    restarting rails. So that’s why I am looking into autoload feature. But
    seems like autoload only loading it from file. It will not load based on
    “string that contain model class”

John John wrote:

E. Litwin wrote:

You may really want to look at a NoSQL option, like MongoDB.

Yes, I indeed using NoSQL. Even with NoSQL, you still need Model Class
to save and retrieve data. :).

oh yeah, I think I found the solution of using Object::const_set

E. Litwin wrote:

You may really want to look at a NoSQL option, like MongoDB.

Yes, I indeed using NoSQL. Even with NoSQL, you still need Model Class
to save and retrieve data. :).

no need to answer find the answer using eval

The next question is.
---------- is it possible to convert this -----
Object::const_set(name.intern, Class::new do
def write
puts “TEST”
end
end
)

--------- convert above to -----------------
string_test = ’ def write
puts “TEST”
end’
Object::const_set(name.intern, Class::new do
string_test
end
)

-------- is that possible?