This is the Cassandra Summit 2014 presentation, talking about growing, scalability at Movile.
Presentation live:
https://www.youtube.com/watch?v=igmLnluGcDM
Apache Cassandra was adopted by Movile in 2009, and became a fundamental piece within the robust and scalable architecture to support more than 50 products, impacted by over 200MM users in Latin America. In this case we present the architecture of our ring, configuration details, detailed tuning, hardware used to be able to achieve our performance requirements (order of a few milliseconds), information storage strategies for network and disk space optimization, and best practices, in addition to showing the evolution of the architecture of simple systems to become scalable and distributed platforms.
We introduced our cluster with a relatively low number of nodes (6) using commodity hardware to support critical high-performance applications. After this talk, you'll understand how Apache Cassandra was essential to evolve our systems and leverage the growth of our business. Movile is the leading mobile content company in Latin America.
Movile’s products include mobile content, mobile TV, mobile learning, mobile games, mobile payment, mobile marketing and mobile commerce. Every month, it publishes content and services to more than 20 million mobile costumers. It has grown substantially over the last few years (with a more than 25-fold increase in its revenue over the last five years) both organically and through an aggressive M&A strategy, including five acquisitions in the last five years. Movile is positioning itself as a kind of Silicon Valley company based in Brazil.
For the last two years, Movile has been named in the “Great Place to Work” list for technology companies in Brazil. The company shareholders include the founders of the company plus Naspers, a South-African media conglomerate.
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
#Cassandra Summit 2014 - A Train of Thoughts About Growing and Scalability
1. A Train of Thought About
Growing and Scalability
Bumping up Startup Business with Apache Cassandra
Eiti Kimura, Software Engineer @
2. Movile is the industry leader for development of mobile
content and commerce platforms in Latin America. With
products for mobile phones, smartphones and tablets.
Games, on-line education, entertainment apps for adults and
kids and many options for buying with confidence and
comfort. All of that comes to you through Movile.
For companies, Movile delivers complete products,
integrating transactions in M-Payments and content
distribution, fast and with quality.
3.
4. Subscription and Billing Platform a.k.a SBS
• It is a service API
• responsible to manage users subscriptions
• charge users in carriers
• renew subscriptions
• “can not” stop anyway
• should be as performatic as possible
5. Some platform numbers
Renewal Engine: ~ 52,1
million of billing tries a
day
• about 603 request/s
• 1,5 billion billing tries
per month
50 million
subscriptions
~ 50 request/s
Operations:
★ subscribe
★ cancel
★ profile
7. Platform Architecture
“There isn’t just one way to state a system’s architecture; rather, there are
multiple architectures in a system, and the view of what is architecturally
significant is one that can change over a system’s lifetime.” - Patterns of
Enterprise Application Architecture
Martin Fowler
10. Very High Usage
• veryyyyy slow... system response
• overall throughput decreased
• low availability, single point of
failure
• Even worse than stopping is to only
work sometimes
11. Improved Distributed Design
A Cassandra Based Solution
• the operations are
distributed across the
nodes
• we achieved linear
scalability
12. Improved Distributed Design
A Cassandra Based Solution
• the performance issues
were solved
• the availability has improved
• there is no longer a single
point of failure
13. C* Data Modeling
• Dernormalization: Writes are cheap, reads are expensive, so insert data in every arrangement that
you need to read
• Don't be afraid of denormalization
• There are different ways to model your solution, there is no right or wrong way
• plan your queries and how you need to get the information before modeling. Use it as driver for
modeling decisions
16. Data Model V1 – Quering Profile
user_subscriptions
phone-number subscription-id
551900001212 subs-093123
551911114567 subs-002202
551911114567 subs-002203
551911114567 subs-002204
#cql> _
1st step
• check the index table to get the ids of
subscriptions for a given user
17. Data Model V1 – Quering Profile
user_subscriptions
phone-number subscription-id
551900001212 subs-093123
551911114567 subs-002202
551911114567 subs-002203
551911114567 subs-002204
#cql> SELECT * FROM user_subscriptions WHERE phone-number = 551911114567;
551911114567 subs-002202
551911114567 subs-002203
551911114567 subs-002204
18. Data Model V1 – Quering Profile
#cql> _
2nd step
• query all the user’s subscriptions by its id
551911114567 subs-002202
551911114567 subs-002203
551911114567 subs-002204
19. Data Model V1 – Quering Profile
#cql> SELECT * FROM subscriptions WHERE subscription-id = ‘subs-002204’;
#cql> SELECT * FROM subscriptions WHERE subscription-id = ‘subs-002203’;
#cql> SELECT * FROM subscriptions WHERE subscription-id = ‘subs-002202’;
subscriptions
subscription-id phone-number config-id . . . enabled creation-date
subs-093123 551900001212 342 . . . true 2013-08-01
subs-002202 551911114567 567 . . . false 2014-06-27
subs-002203 551911114567 678 . . . true 2014-07-05
subs-002204 551911114567 654 . . . true 2014-08-07
20. Data Model V2
CREATE TABLE subscription (
phone-number text,
subscription-id text,
serialized blob,
PRIMARY KEY(phone-number, subscription-id)
);
23. Storage Strategy
• we tried some various ways to store
information
• it optimizes network traffic as well
0
500
1000
1500
2000
2500
1Objectsizeinbytes
Types of object representation
Object Representation
XML Java Byte Array JSON protobuff
24. Database volume
• the database size, decreases
considerably
• less data to handle, more
performance
0.00 20.00 40.00 60.00 80.00 100.00
XML
Java Byte Array
JSON
protobuff
Data Size in GB
StorageStrategy
Subscription Data Volume
25. C* New Data Model
• performance increased significantly
• reduced complexity: from 2 tables to 1, simpler, lighter
• reduced number of remote calls
• V1
• 1 query to the index table
• X queries (one per index returned)
• V2
• 1 query brings all data
• data volume reduced
33. O.S. and Software Customizations
• Java 1.7 + JNA
• Disable Swap
• NTP server in all servers
According to the Cassandra Docs the Recommended Settings for Production
34. O.S. - limits.conf
# number of open files
root soft nofile 100000
root hard nofile 100000
* soft nofile 100000
* hard nofile 100000
# allocated memory
root soft memlock unlimited
root hard memlock unlimited
* soft memlock unlimited
* hard memlock unlimited
# addressing (virtual memory)
root soft as unlimited
root hard as unlimited
* soft as unlimited
* hard as unlimited
# number of open processes
root soft nproc unlimited
root hard nproc unlimited
* soft nproc unlimited
* hard nproc unlimited
36. Conclusion: Why Cassandra?
• Good performance for Reads
• Excellent performance for Writes
• Read and Write throughput highly scalable (linear)
• Supports GEO distributed information
• Fault Tolerant
• Tunable consistency per client
• FOSS (Free and Open Source Software) + Support