Cassandra at Yelp

image







Yelp β€” . 30 . , 5 . . Yelp Cassandra. , Cassandra Day Russia 2021 , Database Reliability Engineer Yelp.







Cassandra β€” NoSQL. , distributed wide-column NoSQL datastore. Cassandra write’, consistency .







, , Cassandra Yelp. . MySQL Cassandra. MySQL , Cassandra . , .







:







  1. : , . , . , .
  2. Cassandra. β€” Cassandra- host port, . , - .
  3. , , .


Cassandra Yelp



90 , 60 Kubernetes- 500 ( β€” Cassandra).







, Read Load β€” 600 . RPS , Write Load β€” 400 RPS. .







image







Yelp . , . , - batch-, -, Cassandra - Cassandra.







- Cassandra. Cassandra , - ; Cassandra caching- distributed tracing β€” Yelp, , ( ).







, .







Cassandra : us-east us-west.







image







, us-east us-west, multi region cluster. us-east, , us-west.







( Kubernetes) Kubernetes-. β€” Cassandra: , , - CPU . , , , β€” . , .







, , , , . , , . etcd. Etcd β€” distributed key-value store.







AWS, EBS volumes β€” Amazon Elastic Block Storage. Kubernetes, .







, Smartstack, Envoy.







Yelp (Schema Changes)



: (schema), , β€” . Cassandra node , , , Cassandra, , - (, - ), Cassandra , β€” , .

, , , , , , , Jira-.







. : Alter Table . , , . . , , . , . , , - , ?







- , -, , , , , Cassandra, , , , butch-, . . : development, staging, production, , production , development.







β€” , . , -, , .







image







, , , Database Reliability, . , SQL-, , , : , , , , , - .







. , , . , , - , , . β€” . - SQL statement .









. Yelp pushplan β€” , , - . . , . , , pushplan. pushplan- Cassandra.







, Yelp. keyspace Cassandra, pushplan dev-, , utility- , pushplan. pushplan, , : Jira-, , , keyspace, . SQL-.







image







SQL-. , , create table. «» pushplan, … , , SQL-.







image







, , . , , β€” . , .







image







, , .







image







, : ID, , , .







image







-. - DRE , , .







, , pushplan. , dev, stage prod. , . , . - , , . , .







image







:







  • SQL-. , , . , , .
  • DRE- best practices. , , primary key; - 20 pushplan β€” . .


.







Cassandra



, Cassandra : Cassandra- Cassandra-.







. , Cassandra, web application .







image







Cassandra- , , Cassandra- : host-, . , - , Cassandra, β€” . , .







image







, proxy-, Apollo. Python, Cassandra-.







image







. -, , Cassandra, host port, , Cassandra. . β€” host port Apollo.







image







SmartStack, , Apollo. host port, : Β« ApolloΒ», SmartStack .







, .







β€” , , DRE, Cassandra-. , , Cassandra, , scale up scale down , , . .







proxy- .







Apollo-. , , - , , .







: β€” . Query-. . , , , .







image







, β€” -… , - 140 40 . 60 . -. , , 60 integration-, . .







, select-, .













, , GET_REVIEWS, , , SQL- .







unit-, swagger spec, β€” end point API Apollo, fake data β€” end-to-end .







image







image







, ( pushplan) , , . , . , - , , . Apollo , : , . .







, - , Apollo, :







  1. . .
  2. Cassandra-, , .


, Stargate. Open Source , DataStax. API . .









Cassandra-, , , . , , β€” . , consistency requirements, , .







image







Stargate. Stargate Cassandra- . : … , Stargate . : , , , . proxy Stargate.







image







, Stargate… Cassandra, , API . REST API, gRPC, WebSocket GraphQL.







image







GraphQL API.







GraphQL



Stargate Cassandra schema β€” , key space , GraphQL-. : Type-safe API. GraphQL over under fetching. : . , Apollo. Cassandra- . , , - .







GraphQL API development . , Facebook ( ), Twitter, Github. Yelp GraphQL.









, . , , - Yelp. , MVP ( Stargate ) β€” , Yelp.







Stargate



Apollo, Stargate : ( node), Cassandra- , β€” 100 , 3 . RPS 24 . ? : Cassandra ? ?







, 24 3 . RPS.







image







rage of latencies , . (high tail) (99.9+), spite.







image







, Stargate :







  1. , , CPU , . high tail latencies, JVM, Stargate .
  2. , , Stargate.


Client libraries



, , ? : http-, REST-. .







swagger spec β€” endpoint, . API endpoint β€” GraphQL/{keyspace}. keyspace GraphQL-. : swagger spec Client Libraries.







image







, , Client Libraries , , , , , , .







, Stargate-. Client Library, GraphQL Query .







image







:







  1. Service Discovery ( , host port).
  2. request budget. , , - Yelp 2 . , 100 . , -.
  3. distributed tracing β€” , .
  4. : , , 200 .


GraphQL Playground



Playground β€” development environment, . GraphQL, Playground. Stargate out of the box. IDE, /graphqlschema, Cassandra-, GraphQL Queries.







: , , .







Operability



Operability, Stargate, , , Yelp-. β€” Distributed Tracing Integration. β€” , - Stargate. , Load… , , CPU, …







Stargate Cassandra-, property, Cassandra- . ( - ) TLS .








All Articles