Memcache'ing versus database field in Django -


in general, better use memcache or database store value property of model regularly (ish) recalculated?

here's scenario...

i have load of users, each of has property called "score.

a score total of last 10 (ordered date) instances of game (there's model relation here - "through" model - complicates description).

i need display user's position (based on score) on page, calculated seeing score lies in list of scores of users.

this huge calculation of getting every single user's score , finding current user's position within list quite long process what's best way of speeding up?

is better use memcache , cache each player's score (which updated once week) or better adding actual database field each user contains current score?

or there (better) way?

it depends on characteristics of server load. how many users, how calculations need run, how calculations take memory , storage space. unless know answers these questions, stick database field, make access have api, can migrate different score storage backend if needed.

also instead of memcached better use persistent cache redis. has characteristics of memcached, can survive server restart, not have run (heavy) calculations on server reboot, increasing downtime.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -