f r o m h a n d t o mo u t h
P a v l o B a r o n G e e k ‘ s p a v l o . b a r o n @c o d e c e n t r i c . d e G u i d e @p a v l o b a r o n T o T h e Wo r k i n g L i f e
F o r g e t b a c k e n d
O r a t l e a s t w h a t y o u c a l l a b a c k e n d
Y o u r a p p l i c a t i o n s e r v e r w i l l j u s t s l o w d o w n y o u r ma c h i n e s t o k e e p s t e p w i t h t h e m
O r y o u w i l l s l o w d o w n y o u r i n c o mi n g t r a f f i c t o g i v e y o u r a p p l i c a t i o n s e r v e r a c h a n c e t o b r e a t h e
I t ' s l i k e : o r d e r f o o d a t Mc D o n a l d s , g e t q u e u e d a n d r e c e i v e t h e o r d e r e d f o o d t h r o u g h ma i l 3 d a y s l a t e r
T r y i n g t o s p e e d i t u p i s l i k e : o r d e r f o o d a t Mc D o n a l d s , g e t q u e u e d , l e a v e t h e r e s t a u r a n t w i t h c o l o r p i c t u r e s o f y o u r f o o d a n d w a i t 3 d a y s f o r i t s d e l i v e r y
E v e r y s i n g l e d a t a a b s t r a c t i o n l a y e r o n l y h e l p s r u i n t h e a t mo s p h e r e t h r o u g h h e a t i n g
H e y , ma n , y o u c a r r y a r o u n d a d a mn U S S E n t e r p r i s e i n y o u r p o c k e t A n d y o u c a n r u n a d a mn B a b y l o n 5 i n a c l u s t e r
A n d i n t h e e n d , i t ' s a l w a y s s t o r e / u p d a t e / d e l e t e / r e a d / s e a r c h / p r o c e s s . I s n ' t i t ?
S o w h y d r i v e a c l o w n c a r w h e n y o u c a n h a v e a F e r r a r i f u l l o f t h e s e ?
Wh y n o t j u s t l i v e f r o m h a n d t o mo u t h ?
Y o u h a z t h i s ? Mo b i l e c l i e n t s w r i t e f r o m e v e r y w h e r e , b u f f e r , r e a d o c c a s i o n a l l y , p o s t - p r o c e s s i n g c o mp l e t e l y b e h i n d t h e s c e n e s , l i k e s t a t i s t i c s e t c .
Z o o m i n ! I mme d i a t e , r e l i a b l e , ma s s i v e w r i t e s . A n a l y t i c s a n d p r o c e s s i n g i n a b a t c h a f t e r w a r d s . N o n e e d t o b e e x a c t t o t h e s e c o n d a n d 1 0 0 % d a t a c o mp l e t e
Z o o m i n !
Z o o m i n ! ProtoBufs, REST Round Robin local REST, local Erlang Buffer Web Apps, R, tools etc.
H T F d o e s i t w o r k ?
D a c o r e
D a r i n g X b i t i n t e g e r s p a c e 0 < = N < = 2 ^ X o r : 2 x P i 0 < = A < = 2 x P i x ( N ) = c o s ( A ) y ( N ) = s i n ( A )
D a c l u s t e r 1 2 p a r t i t i o n s ( c o n s t a n t ) 3 n o d e s , 4 v n o d e s e a c h a d d n o d e 4 n o d e s , 3 v n o d e s e a c h A l t e r n a t i v e s : 3 n o d e s , 2 x 5 + 1 x 2 v n o d e s c o n t a i n e r b a s e d
D a q u o r u m V : v n o d e s h o l d i n g a k e y W: w r i t e q u o r u m R : r e a d q u o r u m D W, P W, P R W > 0 . 5 * V R + W > V
I n s e r t k e y Key = “foo” ( s l o p p y q u o r u m) # = N, W = 2 replicate N ok
A d d n o d e c o p y leave leave copy y p o leave c
L o o k u p k e y ( s l o p p y q u o r u m) N Value = “bar” Key = “foo” # = N, R = 2
R e mo v e n o d e copy leave
D a G o s s i p write RM2 RM1 Clock table Value Update log clock stable updates Replica clock Value Executed operation table
D a v e c t o r c l o c k s Node 1 1,0,0 2,2,0 3,2,0 4,3,3 Node 2 1,1,0 1,2,0 1,3,3 4,4,3 Node 3 1,0,1 1,2,2 1,2,3 4,3,4
D a Ma p R e d u c e query = Node X "Alice" map reduce hit list map map N = N = N = „Alice" "Alice" "Alice" Node A Node B Node C
D a h i n t e d h a n d o f f N : n o d e , G : g r o u p i n c l u d i n g N n o d e ( N ) i s u n a v a i l a b l e r e p l i c a t e t o G o r s t o r e d a t a ( N ) l o c a l l y h i n t h a n d o f f f o r l a t e r n o d e ( N ) i s a l i v e h a n d o f f d a t a t o n o d e ( N )
R e p l i c a Key = “foo”, # = N -> handoff hint = true f a i l s Key = “foo” N replicate
R e p l i c a handoff r e c o v e r s
A n d t h a t ' s b y f a r n o t a l l : Y o u c a n s e a r c h t h r o u g h i n d e x w i t h d a t a l o c a l i t y . Y o u c a n t a g o b j e c t s a n d q u e r y t h r o u g h 2 i . Y o u c a n a d d h o o k s
Y o u d o n ' t e v e n n e e d t o s t o r e a n y t h i n g . J u s t d i s t r i b u t e y o u r c a l c u l a t i o n , s e a r c h , b a t c h
H a v e a l o o k a t t e n d i t a . c o m
S o i t ' s e v e n c o mf y t o l o a d y o u r c l o w n c a r w i t h t h e s e
T h a n k y o u
Mo s t i ma g e s o r i g i n a t e f r o m i s t o c k p h o t o . c o m e x c e p t f e w o n e s t a k e n f r o m Wi k i p e d i a o r F l i c k r ( C C ) a n d p r o d u c t p a g e s / p u b l i c l y a v a i l a b l e p r e s e n t a t i o n s o r g e n e r a t e d t h r o u g h p u b l i c o n l i n e g e n e r a t o r s
Recommend
More recommend