alan
alan

Reputation: 4447

Heroku Postgres RAM for cache vs Memcache RAM

I have a web app on Heroku and I'm trying to understand the difference/ trade-offs between adding a Memcached instance with 1GB of RAM and adding 1GB of RAM to my Postgres server.

If I added a Memcached instance, I would probably use Johnny Cache (for Django - http://packages.python.org/johnny-cache/).

Should I expect similar performance improvement from the two options? In general, what is the advantage of using memcache vs. increasing the size of the Postgres cache. (I understand that people often run memcache on the DB server so there must be one).

I appreciate this is probably a very naive question but I haven't been able to find anything to clear up my confusion through Google.

Upvotes: 4

Views: 3198

Answers (1)

filiprem
filiprem

Reputation: 7124

Postgres for best performance needs enough cache to keep most frequently used object (indexes, tables). So there is a tipping point in setting of shared_buffers. After that point, increasing shared buffers does not help much.

It is good to leave some part of RAM for filesystem-level caching.

For much more see http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server

As for memcache, it's totally different beast... It can be used directly from application to have ultra-fast non-persistent key-value storage.

All three traits make memcached differ from relational database (RDB).

  • ultra-fast (RDB are not)
  • non-persistent (RDB are)
  • key-value only (RDB much better)

Upvotes: 1

Related Questions