PhpXperts seminar 2010,
Work for Fun!!
CodeMan!
with noSQL!
nhm tanveer hossain khan
http://hasan.we4tech.com
PhpXperts seminar 2010,
Work for Fun!!
Super heros!
PhpXperts seminar 2010,
Work for Fun!!
...So this is about
You as a CodeMan!
... CodeMan! CodeMan! help help!
PhpXperts seminar 2010,
Work for Fun!!
Now let's get back to
our discussion –
Database Stuffs!
PhpXperts seminar 2010,
Work for Fun!!
Database!
SELECT books.*
FROM books
LEFT JOIN users
ON books.user_id = users.id
WHE...
PhpXperts seminar 2010,
Work for Fun!!
Known issues with
existing database system!
• Maintaining Relations among the
table...
PhpXperts seminar 2010,
Work for Fun!!
So what about ?
noSQL!!
(Structured
Storage System)
PhpXperts seminar 2010,
Work for Fun!!
About noSQL ?
• NoSQL == Structured storage!
• An initiative to use
alternative of ...
PhpXperts seminar 2010,
Work for Fun!!
Why structured storage over
relational database
• Getting rid of fear
–In larger ex...
PhpXperts seminar 2010,
Work for Fun!!
Let's Think
about a quite
bigger system!
PhpXperts seminar 2010,
Work for Fun!!
Our Possible context!
• Load of data
• Huge data growth
• Extensive database operat...
PhpXperts seminar 2010,
Work for Fun!!
Let's check the
facts!
PhpXperts seminar 2010,
Work for Fun!!
MySQL and other noSQL
systems performance
comparison by Yahoo!
research
PhpXperts seminar 2010,
Work for Fun!!
PhpXperts seminar 2010,
Work for Fun!!
PhpXperts seminar 2010,
Work for Fun!!
What others are
talking about?
Or whoever skipped
relational
database?
PhpXperts seminar 2010,
Work for Fun!!
At facebook!
• Facebook! Around 140 nodes!
• Facebook open sourced cassandra!
PhpXperts seminar 2010,
Work for Fun!!
Digg.com declared to use cassandra!
The fundamental problem is endemic to the relat...
PhpXperts seminar 2010,
Work for Fun!!
Twitter moved their
statuses on cassandra!
We have a lot of data, the growth factor...
PhpXperts seminar 2010,
Work for Fun!!
Few Related References!
• Check out Yahoo! Research's
“Cloud Serving Benchmark”
• M...
PhpXperts seminar 2010,
Work for Fun!!
Time is almost running
out!! let's taste some
noSQL curry!
PhpXperts seminar 2010,
Work for Fun!!
List of available
structured databases
• Hbase - yahoo!
• Voldemort – used in Linke...
PhpXperts seminar 2010,
Work for Fun!!
Let's go with Cassandra!
(cassandra.apache.org)
PhpXperts seminar 2010,
Work for Fun!!
Why cassandra!
• Tested (Facebook, Twitter,
Reddit, Digg, Rackspace etc..)
• Decent...
PhpXperts seminar 2010,
Work for Fun!!
PHP and Cassandra!
Using Phpcassa
library
PhpXperts seminar 2010,
Work for Fun!!
Install cassandra
• Go and download cassandra from here -
http://cassandra.apache.o...
PhpXperts seminar 2010,
Work for Fun!!
Create keyspace and column family
• Extract your download cassandra
archive
• Edit ...
PhpXperts seminar 2010,
Work for Fun!!
Configuration!
<Keyspace Name="AddressBook">
<ColumnFamily Name='Addresses'
Compare...
PhpXperts seminar 2010,
Work for Fun!!
Kick start cassandra!
• $ cd apache-cassandra-0.6.x
• $ ./bin/cassandra
• Get PHP t...
PhpXperts seminar 2010,
Work for Fun!!
Show code!!
• Inserting data into cassandra!
• Listing all added data
• Remove an e...
PhpXperts seminar 2010,
Work for Fun!!
More about cassandra!
• All nodes need to be in
low latency fiber connected
• Still...
PhpXperts seminar 2010,
Work for Fun!!
Before you move!,
you think about -
common sense!
PhpXperts seminar 2010,
Work for Fun!!
Common sense!
• Avoid Big Design Up Front !
• Benchmark your existing system perfor...
PhpXperts seminar 2010,
Work for Fun!!
That's it for today :)
Thanks!
Now you guys should treat me ;)
PhpXperts seminar 2010,
Work for Fun!!
Find out the best restaurant in the
town!
Passion food reviewers community!
http://...
PhpXperts seminar 2010,
Work for Fun!!
- nhm tanveer hossain khan (hasan)
   IT Director, Tasawr Interactive
   hasan@tasa...
PhpXperts seminar 2010,
Work for Fun!!
NOW Q/A
Upcoming SlideShare
Loading in …5
×

phpXperts seminar 2010 CodeMan! with noSQL!

3,436 views

Published on

A presentation on noSQL (structured storage) introduction. this presentation also includes why people should be choosing cassandra over database system.

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,436
On SlideShare
0
From Embeds
0
Number of Embeds
1,671
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

phpXperts seminar 2010 CodeMan! with noSQL!

  1. 1. PhpXperts seminar 2010, Work for Fun!! CodeMan! with noSQL! nhm tanveer hossain khan http://hasan.we4tech.com
  2. 2. PhpXperts seminar 2010, Work for Fun!! Super heros!
  3. 3. PhpXperts seminar 2010, Work for Fun!! ...So this is about You as a CodeMan! ... CodeMan! CodeMan! help help!
  4. 4. PhpXperts seminar 2010, Work for Fun!! Now let's get back to our discussion – Database Stuffs!
  5. 5. PhpXperts seminar 2010, Work for Fun!! Database! SELECT books.* FROM books LEFT JOIN users ON books.user_id = users.id WHERE users.age < 15 Relational Database System Query language!
  6. 6. PhpXperts seminar 2010, Work for Fun!! Known issues with existing database system! • Maintaining Relations among the tables • Table, Page, Row level Locking • Huge data produces huge Fat indexes • Transactional Operations • Parsing SQL query syntax • Multi tables Joining Query
  7. 7. PhpXperts seminar 2010, Work for Fun!! So what about ? noSQL!! (Structured Storage System)
  8. 8. PhpXperts seminar 2010, Work for Fun!! About noSQL ? • NoSQL == Structured storage! • An initiative to use alternative of relational database system • Targeting on the following goals –Performance – Autonomous – Minimizing cost
  9. 9. PhpXperts seminar 2010, Work for Fun!! Why structured storage over relational database • Getting rid of fear –In larger expansion is CHEAP! –No SQL parsing overhead –No table joining –No relation consideration –No single big chunk of data
  10. 10. PhpXperts seminar 2010, Work for Fun!! Let's Think about a quite bigger system!
  11. 11. PhpXperts seminar 2010, Work for Fun!! Our Possible context! • Load of data • Huge data growth • Extensive database operations • Extensive I/O traffic (read/write) • Fault tolerance • Data consistency • Assured availability
  12. 12. PhpXperts seminar 2010, Work for Fun!! Let's check the facts!
  13. 13. PhpXperts seminar 2010, Work for Fun!! MySQL and other noSQL systems performance comparison by Yahoo! research
  14. 14. PhpXperts seminar 2010, Work for Fun!!
  15. 15. PhpXperts seminar 2010, Work for Fun!!
  16. 16. PhpXperts seminar 2010, Work for Fun!! What others are talking about? Or whoever skipped relational database?
  17. 17. PhpXperts seminar 2010, Work for Fun!! At facebook! • Facebook! Around 140 nodes! • Facebook open sourced cassandra!
  18. 18. PhpXperts seminar 2010, Work for Fun!! Digg.com declared to use cassandra! The fundamental problem is endemic to the relational database mindset, which places the burden of computation on reads rather than writes. This is completely wrong for large-scale web applications, where response time is critical. It’s made much worse by the serial nature of most applications. Each component of the page blocks on reads from the data store, as well as the completion of the operations that come before it. Non-relational data stores reverse this model completely, because they don’t have the complex read operations of SQL. Read at home!
  19. 19. PhpXperts seminar 2010, Work for Fun!! Twitter moved their statuses on cassandra! We have a lot of data, the growth factor in that data is huge and the rate of growth is accelerating. We have a system in place based on shared mysql + memcached but its quickly becoming prohibitively costly (in terms of manpower) to operate. We need a system that can grow in a more automated fashion and be highly available. Read at home!
  20. 20. PhpXperts seminar 2010, Work for Fun!! Few Related References! • Check out Yahoo! Research's “Cloud Serving Benchmark” • MySQL and Memcached: End of An era? • An article on how Yoshinori scaled MySQL as noSQL to serve 750,000 qps! Click here
  21. 21. PhpXperts seminar 2010, Work for Fun!! Time is almost running out!! let's taste some noSQL curry!
  22. 22. PhpXperts seminar 2010, Work for Fun!! List of available structured databases • Hbase - yahoo! • Voldemort – used in LinkedIn • MongoDB • MemcacheDB • Riak • Redis • Cassandra – facebook, twitter, digg, Rackspace, Reddit • HyperTable
  23. 23. PhpXperts seminar 2010, Work for Fun!! Let's go with Cassandra! (cassandra.apache.org)
  24. 24. PhpXperts seminar 2010, Work for Fun!! Why cassandra! • Tested (Facebook, Twitter, Reddit, Digg, Rackspace etc..) • Decentralized and No single point of failure • Flexible schema • Elastic • Durable, Data center and Disaster management aware • Highly scalable write
  25. 25. PhpXperts seminar 2010, Work for Fun!! PHP and Cassandra! Using Phpcassa library
  26. 26. PhpXperts seminar 2010, Work for Fun!! Install cassandra • Go and download cassandra from here - http://cassandra.apache.org/ • Ensure you have java runtime on your pc •
  27. 27. PhpXperts seminar 2010, Work for Fun!! Create keyspace and column family • Extract your download cassandra archive • Edit “cofig/storage-config.xml” file in your text editor • Go to the “Keyspaces” block • Add “AddressBook” Keyspace
  28. 28. PhpXperts seminar 2010, Work for Fun!! Configuration! <Keyspace Name="AddressBook"> <ColumnFamily Name='Addresses' CompareWith="TimeUUIDType"/> <ReplicaPlacementStrategy>org.apache.cassandr a.locator.RackUnawareStrategy</ReplicaPlaceme ntStrategy> <ReplicationFactor>1</ReplicationFactor> <EndPointSnitch>org.apache.cassandra.locator. EndPointSnitch</EndPointSnitch> </Keyspace>
  29. 29. PhpXperts seminar 2010, Work for Fun!! Kick start cassandra! • $ cd apache-cassandra-0.6.x • $ ./bin/cassandra • Get PHP thrift library – phpcassa • https://github.com/hoan/phpcassa/
  30. 30. PhpXperts seminar 2010, Work for Fun!! Show code!! • Inserting data into cassandra! • Listing all added data • Remove an existing data
  31. 31. PhpXperts seminar 2010, Work for Fun!! More about cassandra! • All nodes need to be in low latency fiber connected • Still in alpha version! Might have issues! • High RPM hard disk (ie. 15000, 10000)
  32. 32. PhpXperts seminar 2010, Work for Fun!! Before you move!, you think about - common sense!
  33. 33. PhpXperts seminar 2010, Work for Fun!! Common sense! • Avoid Big Design Up Front ! • Benchmark your existing system performance! • Experiment and calculate cost! • Structured database with Dr. Eric Brewer CAP theorem – Consistency - Is the data I’m looking at now the same if I look at it somewhere else? – Availability - What happens if my database goes down? – Partitioning - What if my data is on different networks?
  34. 34. PhpXperts seminar 2010, Work for Fun!! That's it for today :) Thanks! Now you guys should treat me ;)
  35. 35. PhpXperts seminar 2010, Work for Fun!! Find out the best restaurant in the town! Passion food reviewers community! http://restaurant.welltreat.us
  36. 36. PhpXperts seminar 2010, Work for Fun!! - nhm tanveer hossain khan (hasan)    IT Director, Tasawr Interactive    hasan@tasawr.com    Blog: http://hasan.we4tech.com    Twitter: http://twitter.com/we4tech    love programming,     used to write code in Ruby, Java and PHP! Who am i?
  37. 37. PhpXperts seminar 2010, Work for Fun!! NOW Q/A

×