storing a db table in memory

Events happening in the community are now at Drupal community events on www.drupal.org.
gateway69's picture

I have this custom module that creates a db in drupal, the data doesn't change very often and I do some db_query calls to it for some of the things being done on the site.

I know their is some db caching happening but is this table worth saving to memory or disk, what would you guys do in this situation to lighting the load since this table would be called quite often to get some data from?

Comments

Query cache

lotyrin's picture

If it's read-heavy, MySQL's query cache should do fine. Storage in RAM means dealing with making sure a disk copy stays in sync, or potentially losing data. Using the cache system, even if it's backed by memcache or something, might actually be slower.

But generally, this sounds premature. Don't worry about it until it becomes a problem and only make changes based on real-world measured performance.

you could eventually reduce

Hyp1's picture

you could eventually reduce the amounts of db_query's
by using a singleton pattern in your module,
so that the class will only be instantiated once
per page load.

best regards

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: