1

Here's a design question. I have a certain lookup table that doesn't change. It will have about 1000 rows. It may change once every few months.

Should I be holding it in memory, having each PHP app instance 'load it up once' from the DB when it loads and serve it from memory? or should I just query the DB every time it's used?

If using this lookup was a "one million transactions per second" thing, it would have been a no brainer, in-memory. But it's not -- this may be called upon a few times a second only, maybe 5 or 6... but not anymore.

What would you do?

JasonGenX
  • 4,952
  • 27
  • 106
  • 198
  • *'load it up once' from the DB when it loads and serve it from memory* That makes more sense for a `lookup table that doesn't change` – Hanky Panky May 11 '15 at 03:49
  • 1
    Thinking about a multi web server instance + load balancer architecture -- does it makes sense to load this info up in something like Redis or memcached and point all web server instances there? – JasonGenX May 11 '15 at 03:51
  • I would still like to make occasional changes to this data this without changing PHP code. – JasonGenX May 11 '15 at 03:54
  • sounds like a job for : http://php.net/manual/en/book.memcache.php –  May 11 '15 at 04:14
  • You can try some caching mechanism like Redis or Memcached, which "load your data once and serve it from memory". – Hieu Le May 11 '15 at 04:53

1 Answers1

0

i hope this link will be usefull for you It works differents from memcached; in memcached you can access the data from various languages (c, python, etc..) while APC works only for PHP.

How can I store data in RAM memory using PHP?

Community
  • 1
  • 1
channasmcs
  • 1,104
  • 12
  • 27