Nosql taiwan 2012_03_31

  • 3,167 views
Uploaded on

Talk @ NoSQL Taiwan

Talk @ NoSQL Taiwan

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,167
On Slideshare
0
From Embeds
0
Number of Embeds
4

Actions

Shares
Downloads
0
Comments
0
Likes
4

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • \n
  • 多少人用過MySQL\n多少人聽過/用過Redis\n\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Transcript

  • 1. based on real story Poga 2012.03.31
  • 2. 你好 안녕salut Hi こんにちは ciao Hallo
  • 3. iPoga
  • 4. iwear many hats
  • 5. iwear many hatsbuild products
  • 6. Product released Let’s PARTY?
  • 7. DatabaseCPU Utilization
  • 8. Performance Degrading = Unhappy User = Less Profit
  • 9. Complex QueriesInefficient schema
  • 10. Limited Time
  • 11. JustADD itto your stack
  • 12. a c e p lN o t Re Just ADD it to your stack
  • 13. Special Simple In-memoryPerformance Atomic
  • 14. Special Simple In-memoryPerformance Atomic
  • 15. Management Problem a.k.a. “We don’t have a MIS”
  • 16. Dependency Feb 25, 2009 Oct 14, 2011 Mar 31, 2012 Redis 2.4 First external dependencyFirst public beta jemalloc
  • 17. Installation Feb 25, 2009 Oct 14, 2011 Mar 31, 2012 Redis 2.4 First external dependencyFirst public beta jemalloc make install make install
  • 18. Stable
  • 19. Special Simple In-memoryPerformance Atomic
  • 20. Special Simple In-memoryPerformance Atomic
  • 21. Redis In-MemoryHigh Performance Data Structures Persistence Memcached Replication In-Memory ... High Performance Simple Key-Value
  • 22. Data StructuresList, Set, Sorted Set, Hash, String http://redis.io/commands
  • 23. Every command in Redis is manipulating a data structureUnderstand your problem http://nosql.mypopescu.com/post/18977451039/redis-guide-what-each-redis-data-type-should-be-used
  • 24. Special Simple In-memoryPerformance Atomic
  • 25. Special Simple In-memoryPerformance Atomic
  • 26. =
  • 27. FASThttp://redis.io/topics/benchmarks for real
  • 28. Special Simple In-memoryPerformance Atomic
  • 29. No Race Condition every command in redis is atomic use redis as a incremental counter“There are very few systems that support an “increment and return” operation, and Redis is one of them (Oracle sequences are another).” http://nateware.com/2010/02/18/an-atomic-rant/
  • 30. No Race Condition every command in redis is atomicCombine multiple command: still atomic! MULTI SET key 123 SET key2 456 EXEC Warning: Don’t confuse with transaction
  • 31. Special Simple In-memoryPerformance Atomic
  • 32. i
  • 33. Did I make any changes to MySQL? NO It’s still our main database
  • 34. Did I solve the problem? YESsolve complex queries via Redis data structure
  • 35. Happy Database Add Redis to stack
  • 36. How?Sorted Set: Per user notification String: API request limiter String, List: Request logging List: Job Queue
  • 37. Real World = RiskPersistence Replication Sharding
  • 38. Persistence RDB AOF
  • 39. RDB• Snapshot• Compact• .rdb file can be transfered to other backup system• Chances to lose data
  • 40. AOF• logs of every write operation• durable• bigger file size
  • 41. You want a degree of safetycomparable to PostgreSQL? Just use BOTH
  • 42. Replication SlaveMaster Slave Slave
  • 43. Replication• Read-only salves• Save on slaves
  • 44. Sharding• Memory is limited• Split data into multiple redis servers
  • 45. Presharding Multiple MachineSingle Machine Redis instanceRedis instance Redis instanceRedis instanceRedis instance Redis instanceRedis instance Redis instanceRedis instance Redis instance
  • 46. Some Case Study• Resque• Rubygems.org• Tumblr• Instagram
  • 47. ResqueHigh Performance Job Queue https://github.com/blog/542-introducing-resque
  • 48. Rubygems.org feature switch API request limit Logging Job Queue http://www.scribd.com/doc/34269414/Redis-Persistence-Power
  • 49. Tumblr Per-user Notification30,000 request/s per server http://engineering.tumblr.com/post/7819252942/staircar-redis-powered-notifications
  • 50. InstagramSimple Key-value mapping 1/3 cost on hardware http://engineering.tumblr.com/post/7819252942/staircar-redis-powered-notifications
  • 51. iCross server temporary file sharing Redis string is binary-safe
  • 52. Future
  • 53. Lua Scripting Watchdog Future
  • 54. Lua Scripting AtomicSaving bandwidth between servers
  • 55. Sum up 200,000 valuesRuby Redis ... 200,000 times
  • 56. Sum up 200,000 values, with Lua scripting Ruby Redis 1 request
  • 57. Query Data Model Scripting LanguageMySQL Relational Table SQLRedis Data Structures Lua Lua
  • 58. Watchdog Let Redis monitor itself Like slow queries in MySQLMore information to diagnose problem
  • 59. Lua Scripting Watchdog Bright Future
  • 60. = Unique
  • 61. Unique= Not replacing anyone Job security of other database
  • 62. What will u get
  • 63. More life less costHappy User
  • 64. Thank you question? @devpoga