Couch Speeding
   speed up your couchdb
         Taylor Luk




                           idealian
CouchDB

• CouchDb is a document-oriented database
• RESTFul
• JSON data format
• Map/Reduce
• Schema-free
Case Study

• Build is a analytic and tracking library that i
  have build to to do custom tracking for
  couple projects ...
CouchDB looks good
• It's restful
  "how about logging and tracking from both
  client side and server side."
• Schema fre...
Not quite...

• Higher latency
• Slow insert performance
• Slow view query index
• Large storage requirement
• Updating an...
Speed up CouchDB -
   Bulk operations
• Bulk operations for insert and delete
           CouchRest
           mydb.builk_s...
Speed up CouchDB - 
Intelligent Sequential ID
  • Optimize B-Tree storage
  • Lower record size
  • Free timestamps and in...
Speed up CouchDB - 
 Intelligent Sequential ID
"_id":"012471a4cb6124ba54dd49204b41c46e"

 # Ruby
 def created_at
   Time.a...
Speed up CouchDB - 
   View and updates
• View updating is slow (initial)
• Lower the number of emit() in your map
  funct...
Speed up CouchDB - 
   useful tips and bits
• CouchDB v0.10 - faster insert performance
• Compaction helps data storage si...
Thank you

• email: taylor.luk@idealian.net
• github: speedmax
• twitter : @taylor_luk
• blog : www.taylorluk.com
Upcoming SlideShare
Loading in …5
×

Speeding Couch

3,109 views

Published on

Slides for the talk i gave on November roro meetup.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,109
On SlideShare
0
From Embeds
0
Number of Embeds
1,175
Actions
Shares
0
Downloads
17
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Speeding Couch

    1. 1. Couch Speeding speed up your couchdb Taylor Luk idealian
    2. 2. CouchDB • CouchDb is a document-oriented database • RESTFul • JSON data format • Map/Reduce • Schema-free
    3. 3. Case Study • Build is a analytic and tracking library that i have build to to do custom tracking for couple projects i am working on..
    4. 4. CouchDB looks good • It's restful "how about logging and tracking from both client side and server side." • Schema free "So i can track all kind of actions with different kind of meta data.Video playback, View, Click, Enter and exit" • Speed
    5. 5. Not quite... • Higher latency • Slow insert performance • Slow view query index • Large storage requirement • Updating and locking issues
    6. 6. Speed up CouchDB - Bulk operations • Bulk operations for insert and delete CouchRest mydb.builk_save({ doc1, doc2 })
    7. 7. Speed up CouchDB -  Intelligent Sequential ID • Optimize B-Tree storage • Lower record size • Free timestamps and index # Couch ID "_id":"012471a4cb6124ba54dd49204b41c46e" #Generate timestamp (Time.now.to_f *1000).to_i.to_s(16)
    8. 8. Speed up CouchDB -  Intelligent Sequential ID "_id":"012471a4cb6124ba54dd49204b41c46e" # Ruby def created_at   Time.at(self.id[0, 11].to_i(10) / 1000) end #Javascript var timestamp = parseInt(object._id.substring(0,11), 16); var date = new Date(timestamp);
    9. 9. Speed up CouchDB -  View and updates • View updating is slow (initial) • Lower the number of emit() in your map function • Trade storage for speed • Aggregation and Summerized records
    10. 10. Speed up CouchDB -  useful tips and bits • CouchDB v0.10 - faster insert performance • Compaction helps data storage size • think about your data structure • experimentation*   Alternitive - MySQL myisam is decent for data warehousing - Relational database for transactions ($) - MongoDB for analytic
    11. 11. Thank you • email: taylor.luk@idealian.net • github: speedmax • twitter : @taylor_luk • blog : www.taylorluk.com

    ×