-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
1/47
How MySQL and NoSQL Coexist
Matt Yonkovit - Percona
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
2/47
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
3/47
Who Am I
Matt Yonkovit - Principal Consultant Percona
MySQL-Sun !eteran
"#$ years %ata&ase 'xperienceLots o( (un at parties
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
4/47
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
5/47
What We do
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
6/47
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
7/47
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
8/47
MySQL !oc"s sca#e "$
Look at t*e advances madewit*in innod&
,Scala&ility to $cores
,SS% en*ancements
,%ealin/ wit* me/a-si0ed &u((erspools
1*is (its wit* *ardware
,Multi-core,Lots o( memory standard
,C*eap 2las*
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
9/47
We Need More Ser%ers&
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
10/47
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
11/47
De%e#o$ers want easy and !ast
SQL 9s Power(ul
4ut SQL can &e overly complex (or manyoperations
Sometimes :ptimi0ers in 3%4M6s do stupid t*in/sand developers can do it &etter
SQL is yet anot*er component a developer needsto learn
'ven (or Simple SQL operations t*ere is over*eadto parse;execute
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
12/47
ORM S"c's
4ecause developers want to &e (ocused on &ein/super developer nin like active record ? work /reat (or simple
applications8 &ut tend to &ork w*en you *avecomplex mappin/s
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
13/47
(ast Mo%in) Chan)es
)*at data and *ow t*at data is stored is c*an/in/at a &reak neck pace
C*an/es to lar/e data&ases are *ard
,'xample 9n a presentation Crai/slist said t*eirarc*ive d& took " mont*to alter a ta&le.
,:t*er alters can still
take days or weeks
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
14/47
Missed o$$ort"nities
)*ile t*e MySQLcommunity as aw*ole *as done an
awesome 7dd;Mod column ? Scale out -vs- Scale up 2lexi&le data types
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
15/47
How other )ro"$s tac'#ed the$ro*#ems
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
16/47
+he Rise o! NoSQL
3%4M6s o( old did not keep up wit* t*e demand
Need (or (ast8 e((icient data access
'liminate t*e pain points
'liminate t*e unneeded (lu((
,Many we&sites /ot alon/ well wit*out t*in/s like2unctions8 Stored porcs8 (ull acid8 compliance8 etc.
,
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
17/47
NoSQL Co%ers a #ot
@ey;!alue
,i.e. memcac*ed8 redis
Column Stores
,i.e. H&ase
%ocument Stores
,i.e. Mon/o8Couc*
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
18/47
More ,de%e#o$er- centricinter!ace
9nstead o( relyin/ on a SQL inter(ace manyNoSQL solutions allow develoeprs to stay in codeand directly access o&
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
19/47
Sca#e o"t
3emove t*e complexities andautomate s*ardin/
Make (ull use o( multipleservers (or complex tasks
,i.e. map reduce
7&ility to add servers ondemand
Support (or (ail-over andreplication
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
20/47
Easy to chan)e
C*an/e is a certainty in li(e... Asers will demanditB
Make sure t*at you are
not &ound to a ri/idstructure
,7llow (or c*an/eson t*e (ly
(lexi&le sc*emaD
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
21/47
C"stom (eat"res
7dd support (or (eatures missin/ in MySQL or t*atsolve a speci(ic need
,Erid2S >Mon/o?
,Super Columns >Cassandra?,Lists;Sets >3edis?
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
22/47
Where are we now.SQL /%s/ NOSQL.
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
23/47
+oo M"ch (0D7 lot o( developers like to *ate on MySQL
7 NoSQL Solution >Like Mon/o? doesnot mean+
,You do not *ave to t*ink a&out yourdata types and sc*emaD desi/n
,%oes not mean add nodes will solveall your issues
,%oes not mean you can /et sloppy
wit* code,)ill not (ully replace a relational d&
4ad Code is 4ad Code
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
24/47
As com$#ex as yo" ma'e it
You still *ave to t*ink wit* NoSQL
,How will t*is data &e used
,)ill we *ave to correlate t*is data wit* ot*er data
in t*e system,)ill duplication o( data cause issuesF 4loatspaceF
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
25/47
+oo M"ch (0D7 lot o( people in MySQL *ate on NoSQL
Not 7ll N:SQLD solutions are made t*e same
,Some o( t*em are dura&le8 or are addin/ dura&ility(eatures > i.e. mon/o in ".G$ ?
,)*ile in most N:SQLD more memory &etterper(ormance8 t*e same *olds true (or MySQL
,Not every solution is eventual consistency
3emem&er MySQL started as t*at ot*er tec*nolo/yD8
mocked &y classic %476sMany o( t*ese solutions are at similar places w*ere MySQL
was I-J years a/o.
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
26/47
MySQL is not Sittin) Id#e
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
27/47
Lessons !rom ND1
9n Many ways MySQL *as *ad a NoSQLDsolution availa&le (or years
N%4 > MysKl Cluster ? is at its code a NoSQLD
solution wit* a SQL wrapperMany deployments o( N%4 need to &ypass t*eSQL layer and write directly to t*e N%4 7P9 inorder to ac*ieve optimal per(ormance
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
28/47
Parsin) SQL Can *e s#owli&mysKl >7kiras Num&ers?
samples sym&ol name
JG5 J.J## MYSQLParse>voidO?
"J5 .J5 mypt*read(astmutexlock5#I5I ."I make=?
"G .5#55 &trsearc*/uesson*as*
Sources+http://www.mysqlperformanceblog.com/2011/03/16/where-does-handlersocket-really-save-youtme/http://www.sldeshare.net/akrahguch/handlersocket-2010062!en-"6!#21"
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
29/47
Hand#er Soc'et
%eveloped &y %eN7
%irect 7ccess to t*e 9nnod& stora/e en/ine8&ypassin/ SQL
@ey-!alue type access
Yos*inori *it J#5@ QPS8 (aster t*en memcac*ed8and JR (aster t*en Stock SQL
*ttp+;;yos*inorimatsuno&u.&lo/spot.com;5"5;"5;usin/-mysKl-as-nosKl-story-(or.*tml
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
30/47
Hand#er Soc'et Per!ormance
4enc*mark &y !adim+*ttp+;;www.mysKlper(ormance&lo/.com;5"5;"";5;*andlersocket-on-ssd;
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
31/47
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
32/47
Q"estion
Sho"#d yo" "se MySQL orLoo' at NoSQL So#"tion.
AnswerIt de$ends on
yo"r a$$#ication2
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
33/47
Q"estions yo" sho"#d as'
%o you need transactionsF Can you risk data lossF
)*at are your per(ormance reKuirementsF
)*at level o( risk is accepta&leF
Costs involvedF Hard costs+ Servers8 9n(rastructure
So(t costs+ %eveloper 1ime
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
34/47
3enera# MySQL Considerations
%ura&ility important > 9s some data lossaccepta&leF ?
rdParty applications
9nte/ration wit* ot*er 3%4MS6s7lready invested in SQLF
:L1P type )orkloadsF
1ransactions
oins
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
35/47
3enera# NoSQL Considerations
SQL 9s :verkill
,Simple @ey !aluesF
%ocument :riented
,No Standard 2orm or Consistent data stream3eKuire CPA 4ased resources (rom several mac*ines
Hu/e amounts o( arc*ived data
3apid C*an/es to t*e structures
Possi&le data inconsistencies
,'ventual consistency &y product
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
36/47
Per!ormance.
Per(ormance (or &ot* MySQL and NoSQL solutions can varywildly.
9mpacted &y+
,Sc*ema;:&
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
37/47
S$ace
)it* Hu/e %atasets8 space can &e a premium
Some NoSQL options can take up a lot morespace t*en t*eir MySQL counter parts.
RML 'xample >no redundant data?+,.#E4 in Mon/o%4
,GIM4 in 9nnod&
Some solutions *ave you duplicate data (orper(ormance and simplicity
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
38/47
+ho" sha## 1enchmar'1rust8 &ut veri(y
i!
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
39/47
4eri!y
9 *ave run into a lot o( people w*o leap &e(oret*ey test
,7skin/ (or trou&le
%on6t &e trapped &y le/acy pro&lems,9( you *ave &ad sKl code8 its not MySQL6s (ault T?
Ase speci(ic &enc*marks8 not /eneric ones
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
40/47
NoSQL O$tions
M D1
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
41/47
Mon)oD1
Nice son centric datastora/e
,%o not underestimate
Map3educe capa&ilities
4etter dura&ility in version".G$
4uilt in s*ardin/
3eplication
No Native oins
1rade per(ormance (orconsistency
%ata (ootprint can &e &i//er
t*en MysKl in some cases
R di
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
42/47
Redis
Pros:
2ast w*en (ully in memory8&ut can use virtual memoryD
Supports clusterin/D
Supports replication
Super (ast
Complex data types like lists
Cons:
Asin/ !irtual Memoryprevents usin/ ot*er (eatures
%ata loss possi&le
No Native
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
43/47
Cassandra
Pros:
7uto-S*ardin/ o( data
3eplication
Parallel Processin/Super Columns areinterestin/
Cons:
'ventual Consistency
%ocumentation not as deepas ot*er solutions
Speed is &y product o( addin/more nodes
Network C*atty
%ura&ility issues
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
44/47
+o' o Ca*inet
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
45/47
+o'yo Ca*inet
Pros:
Can 4e Super 2ast
Multiple 1a&le 1ypes tosupport di((erent reKuirements
'm&edda&le
3eplication
Can use Memcac*ed protocol
Cons:
No 4uilt in S*ardin/
%ura&ility;Consistency issues
Lack o( %ocumentationCan 4o/ down i( you run outo( memory
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
46/47
MySQL +ric's
-
8/13/2019 PerconaLiveNYC2011 How MySQL and NoSQL Coexist
47/47
MySQL +ric's
1*ere are ways to solve t*e NoSQLD issues inMySQL8 &ut t*ey are manual or add complexity
,Stora/e en/ines
,S*ard Query
,RML %ata
,S*ardin/
,N%4;Cluster