Redis Note

  • Due to the recent research on big data conducted by laboratory of Computer Aidded Design and Computer Graphics, I made a brief summary over Redis here. Hope that will be helpful.
  • Like Memcached, Redis is a kind of key-value database based on the memory. Support value types like:
    • list
    • string
    • set
    • zset(sequencial set)
    • hash
  • Support Client on Java, C/C++, C#, PHP, JavaScript, Perl, Object-C, Python, Ruby, Erlang. (more authoritative details).
  • Simple Installation()
    • Download package from Redis.
    • cd into the extracted catalog and do make
    • cd into the subfile ./redis-3.0.0/src to start redis-server and execute redis-cli(more details)
  • Redis has three main part , which are seperately memory storage, disk storage and Log file. There are three parameters corespondding to them are included in the configuration file:
    • savesave seconds updates, determines the frequency of updateoperation. It accepts more than one condition.
    • appendonly:appendonly yes/no, means to start the log for Redis or not. Because synchronization is conducted by save, mentioned above, mass of data may get lost when the machine shutdown or power off, if there were no log to record that.
    • appendfsync:appendfsync no/always/everysec, no denotes waiting for system I/O to write the data from memory to disk,always denotes calling fsync() to update the data in disk after save, everysec denotes update every second.
  • Redis doesn’t have much inside memery manage optimization, only having improvement on number type value:provide a number value pool from 1 to n for a better memory manage. Max value, n, can be set by modifying REDIS_SHARED_INTEGERS macro.
  • Redis vs. HBase over I/O:I/O of Redis is around 100,000 ops,delay from 10 to 70 milliseconds while local I/O of HBase is no more than 1,000ops/s,delay from 1 to 5 milliseconds.
  • Redis vs. HBase on security:theoretically, HBase has something like Redo Log of Oracle(Write-ahead Log), therefore, data losing is hard to survive. Due to the outrageous price of data migration from memory to disk, the only way to implement data persistence is to make a data backup in the disk of slave machine. However, it is probable to get data lost when failover happens.