mysql - Using Redis to cache data that is in use in a Real TIme Single Page App -


i've got web application, has normal feature, user settings etc these stored in mysql user etc.....

a particular part of application table of data user edit.

i make table real time, across multiple users. ie multiple users can open page edit data , see changes in real time done other users editing table.

my thinking cache data table in redis, preform actions in redis keeping clients date.

once connection have closed particular table save data mysql persistence, know redis can used persistent nosql database ram limited , other data stored in mysql, mysql seems better option.

is correct use case redis? thinking correct?

it depends on scalability. number of records going deal , structure going use saving it.

i discuss pros , crons of using redis. decision you.

advantages of using redis:

    1) can handle heavy writes , reads in comparison mysql     2) has flexible structures (hashmap, sorted set etc) can  localise writes instead of blocking whole table.     3) read queries faster served cache. 

disadvantages of using redis:

    1) maintaining transactions. happens if both users try access      particular cell @ time? have right data structure in redis      handle case?     2) if data huge? exceed memory limit.      3) happens if there outage?     4) if plan persistence of redis. using rdb or aof.      handle 5-10 seconds of downtime? 

things focussed:

1) how data going deal with? assume table of 10000 rows wit 10 columns in redis takes 1 gb of memory (just assumption actual memory less). if redis 10gb cluster can handle 10 such tables. math of how many rows * column * live tables going work , memory consumes.

2) redis uses compression data within range http://redis.io/topics/memory-optimization. let decide save table hashmap, have 2 options, each column can have hashmap or each row can have hashmap. second option optimal one. because storing 1000 (hashmaps -> rows) * 20 (records in each hash map -> columns) take 10 time less memory storing in other way. in way if cell changed can localize in hashmap of within 20 values.

3) loading data in mysql. how going happen? if work load high mysql begins perform worse other operations.

4) how going deal multiple clients on notifying changes? load whole table or part changes? loading changed part optimal one. in case, maintain list of cells have been altered?

evaluate system these questions , find whether feasible or not.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -