Upload
avnerner
View
85
Download
2
Tags:
Embed Size (px)
Citation preview
Databases - Which, Why and Usage Tips
Avner Cohen Infrastructure & Architecture @ Fiverr Birdwatcher @ Sewage Pools
@avnerner
AvnerCohen @ Github
RDBMS
Relational Database Management System
NoSQL Not Only SQL - but mainly, not RDBMS
Acronyms
CAP theorem“.. it is impossible for a distributed computer system to simultaneously provide all three of the following guarantees Consistency, Availability, Partition tolerance “ - Eric Brewer, 1998
ACID“.. a set of properties that guarantee that database transactions are processed reliably - Atomicity - Consistency - Isolation - Durability”
BASE“.. an alternative to ACID - Basic Availability, Soft-state, Eventual consistency “
NewSQL
Solving scalability without compromising on ACIDHOW?
.. CAP Theorem isn’t simply a case of consistency, availability, partition tolerance. Pick two…
Call me Maybeby Kyle Kingsbury• “Breaking distributed systems so you
don't have to.”• https://github.com/aphyr/jepsen• http://aphyr.com/tags/jepsen
Now What ?
@ Fiverr
MySQLProperties• Traditional RDBMS• Owns by Oracle and widely used• Open source• Pluggable storage engines (MyISAM, InnoDB, Federated,
more)Stuff etc.•Multiple forks (MariaDB, PerconaDB, WebScaleSQL)•Master/Slave setup and pitfalls (Octopus, DBCharmer, MaxScale, Mysql Proxy)
•Master/Master - Galera Cluster•Shlomi Noach’s http://code.openark.org/forge/openark-kit, https://github.com/outbrain/propagator
•Rails 4 default - strict: false
MongoDBProperties• Document based
• BSON (Binary JSON)• Open source• Indices - primary and secondaries• No JoinsStuff etc.•Console - https://github.com/TylerBrock/mongo-hacker•UI - Mongohub (up to date fork - https://github.com/jeromelebel/MongoHub-Mac)
•Eventual consistent, configurable, query level•Gems: Moped, Mongoid, mongo-driver, BSON•TokuMX- https://github.com/Tokutek/mongo•_id can (and should) be overwritten.
PostgreSQLProperties• Traditional RDBMS• (Still) Open Source• Semi structured (JSON) data
Stuff etc.• The Rails goto nowadays.• “..Some people use <NoSQL solution> Just for the
schemaless feature..”
RedisProperties• REmote DIctionary Server• Data Structure server, single threaded• In memory but also persisted to disk• Master/Slave (Cluster in 4yo beta, but is coming.)• One man showStuff etc.• Know your date-types (Sorted Sets, Arrays, etc.)• Redis-faina - https://github.com/facebookarchive/redis-
faina• BGSAVE forking issues• HyperLogLog - http://antirez.com/news/75• Do not kill -9 a diskeless master… - https://stripe.com/blog/
game-day-exercises-at-stripe (a.k.a the stripe-redis drama)
MemcachedProperties• As basic as it gets Key Value• in-memory• client side sharding• Efficient in large data blocks
Stuff etc.• Dalli• Compression• MasterCacheKey• Name Spacing
CouchbaseProperties• Document store• Memcached layer out of the box• Views• Operation tooling
Stuff etc.• Querying is a PITA• “Thick” clients• LivePerson and Viber
Apache SolrProperties• Search Server• Server on top of Lucene• Fuzzy search• Vibrant and productive community
Stuff etc.• Query slave, index master• Extended DisMax• Indexing solutions• Micro service
Wrapping up
• Polyglot Persistence - Martin Fowler• Use as a micro services enabler• Learn from Kyle - Embrace Failure
Thank You.
@avnerner
AvnerCohen @ Github