SlideShare uma empresa Scribd logo
1 de 20
Baixar para ler offline
Database Architecture
Case Study: SMS Gyan
About Me
Shyam Anand
Senior Software Engineer at Google.
Previously worked with several startups.
Works on distributed systems, system architecture, etc.
linkedin.com/in/shyamanand
We’ll talk about databases.
With a case-study of SMS Gyan.
● SMS Gyan was launched by Innoz in 2008.
● An SMS based answering engine, came to be known as “Internet on SMS”.
SMS
Introduction
airtel SMS Gyan
HTTP
Database Systems
Data modelling is perhaps the most important part of developing software.
Decision on how to structure, store, and retrieve data can affect the entire
application, throughout its life.
There are several factors to consider while choosing a database, such as,
● Structure of the data
● Expected data volume
● Performance requirements
Relational vs Non-Relational Databases
Relational
For structured data.
Stores data in tables that may share information (and
hence, “Relational”).
Uses JOIN queries to access data in different tables.
Performance tuning becomes necessary with large
volumes of data.
Relatively difficult to scale out.
Lacks flexibility in how data is stored.
Atomicity, Consistency, Isolation, and Durability (ACID)
guarantees.
Non-Relational
For unstructured data (documents).
No concept of tables, fields/columns.
MongoDB, And Elasticsearch store data as JSON-like
documents.
Supports data locality.
Can easily support very large volumes of data.
Easier to scale out, because of native support for
replication, sharding, etc.
Can support changes to the structure of data stored,
making it easier to modify the application layer.
No transactions (typically), so no ACID guarantees.
Some provide Eventual Consistency.
Consistency or Availability?
● Network partitions will inevitably happen in a distributed system.
● Choosing between a relational vs non-relational db can boil down to this
question.
● The first version was a simple PHP app with a MySQL database.
● Supported a few hundred users and a few hundred queries a day.
SMS Gyan
Telecom
Operator
mysql
<network>
backend
smsgyan
app
MySQL
● A Relational Database Management System (RDBMS).
● One of the most popular databases.
● Free and open-source, easy to get started.
● Reliable and scalable.
Data Modelling
Need to store
● The queries from users
● The answers to the queries (as a local cache)
● User details (network operator, whether a subscriber, etc)
phone network is_subscribed query result source query_ts
9876543210 airtel 1 MySQL MySQL is
…
wikipedia 2009-11-10 12:00:00
Schema
phone query query_ts
9876543210 MySQL 2009-11-10 12:00:00
phone network is_subscribed last_active
9876543210 airtel 1 2009-11-10
queries
users
query result source
MySQL MySQL is an open-source
...
wikipedia
knowledge_base
High volume of airtel 121 requests
● The application was receiving a large number of requests (> 1000 qps).
● Caused the database to become slow, and the requests to fail (SLA violation).
Scaling
App DB Airtel
X
X
MySQL Replication
smsgyan
smsgyan/
users
smsgyan
/users
Writes
Reads
Reads
smsgyan
app
network
services
Architecture Details
smsgyan
/users
smsgyan
db
smsgyan
app
Replication
network
services
smsgyan
/users
● MySQL FULLTEXT index was used.
● The results were sometimes not accurate, especially for queries that are
sentences or phrases.
● MySQL performance was deteriorating as the data volume was increasing.
Improving search results
query result source
MySQL MySQL is an
open-source...
wikipedia
queries
● Designed for really fast text searches. Supports stemming, ranking, etc.
● Data is stored as documents. Provides REST APIs to read and write data.
● Highly available, scalable, and (relatively) easy to configure.
● Natively supports sharding and replication.
Elasticsearch
smsgyan
app
Elasticsearch cluster
Elasticsearch
Cluster: Consists of one or more nodes.
Node: An instance of ES.
Index: A logical namespace, maps to one or more primary shards, and can have 0 or more
replica shards.
Document: A record stored in ES.
Shard: A single low-level worker unit managed by ES.
Primary Shard: Each document is stored in a primary shard.
Replica Shard: A copy of a Primary shard. Each primary shard can have 0 or more replicas.
Replicas help distribute ES’s load, and can help in failover if a primary shard is unavailable.
Caching
Pagination of results
● SMS replies put a limit on the length of content, so a whole wikipedia article
would be returned as several pages.
● Users need to send SMS to retrieve each page.
Redis
● A distributed, in-memory data structure store.
○ Can store simple key values, Sets, Lists, Ordered Lists, etc., and can perform operations such
as Set union/intersection, push/pop to/from Lists, etc.
● Can be used as an in-memory key-value db, cache, and message broker.
● Durability is optional.
● Different function from the databases discussed earlier.
Redis
In SMS Gyan
1. Fetch query result (database, or source on internet)
2. Write the entire result into cache, with user’s phone number as key.
3. Extract a page (upto 240 characters) and send to user, remove the served
page from the content in cache.
4. If user requests more pages, do step 3.
5. Clear the key if
a. The user sends a different query, or
b. There is no request from user for a specific period of time.
Thank you!

Mais conteúdo relacionado

Semelhante a Database Architecture - Case Study - SMS Gyan.pdf

Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdfCompare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdfarihantplastictanksh
 
Understanding and building big data Architectures - NoSQL
Understanding and building big data Architectures - NoSQLUnderstanding and building big data Architectures - NoSQL
Understanding and building big data Architectures - NoSQLHyderabad Scalability Meetup
 
London Cloud Computing Meetup: From GigaSpaces to the Cloud - a demonstration...
London Cloud Computing Meetup: From GigaSpaces to the Cloud - a demonstration...London Cloud Computing Meetup: From GigaSpaces to the Cloud - a demonstration...
London Cloud Computing Meetup: From GigaSpaces to the Cloud - a demonstration...Skills Matter
 
Maginatics @ SDC 2013: Architecting An Enterprise Storage Platform Using Obje...
Maginatics @ SDC 2013: Architecting An Enterprise Storage Platform Using Obje...Maginatics @ SDC 2013: Architecting An Enterprise Storage Platform Using Obje...
Maginatics @ SDC 2013: Architecting An Enterprise Storage Platform Using Obje...Maginatics
 
Efficient and scalable multitenant placement approach for in memory database ...
Efficient and scalable multitenant placement approach for in memory database ...Efficient and scalable multitenant placement approach for in memory database ...
Efficient and scalable multitenant placement approach for in memory database ...CSITiaesprime
 
مقدمة عن NoSQL بالعربي
مقدمة عن NoSQL بالعربيمقدمة عن NoSQL بالعربي
مقدمة عن NoSQL بالعربيMohamed Galal
 
Data has a better idea the in-memory data grid
Data has a better idea   the in-memory data gridData has a better idea   the in-memory data grid
Data has a better idea the in-memory data gridBogdan Dina
 
Relational databases vs Non-relational databases
Relational databases vs Non-relational databasesRelational databases vs Non-relational databases
Relational databases vs Non-relational databasesJames Serra
 
Big Data on Cloud Native Platform
Big Data on Cloud Native PlatformBig Data on Cloud Native Platform
Big Data on Cloud Native PlatformSunil Govindan
 
Big Data on Cloud Native Platform
Big Data on Cloud Native PlatformBig Data on Cloud Native Platform
Big Data on Cloud Native PlatformSunil Govindan
 
NOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQLNOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQLRamakant Soni
 
NOSQL in big data is the not only structure langua.pdf
NOSQL in big data is the not only structure langua.pdfNOSQL in big data is the not only structure langua.pdf
NOSQL in big data is the not only structure langua.pdfajajkhan16
 
Slides: Relational to NoSQL Migration
Slides: Relational to NoSQL MigrationSlides: Relational to NoSQL Migration
Slides: Relational to NoSQL MigrationDATAVERSITY
 

Semelhante a Database Architecture - Case Study - SMS Gyan.pdf (20)

Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdfCompare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
 
Understanding and building big data Architectures - NoSQL
Understanding and building big data Architectures - NoSQLUnderstanding and building big data Architectures - NoSQL
Understanding and building big data Architectures - NoSQL
 
L21 scalability
L21 scalabilityL21 scalability
L21 scalability
 
Report 2.0.docx
Report 2.0.docxReport 2.0.docx
Report 2.0.docx
 
London Cloud Computing Meetup: From GigaSpaces to the Cloud - a demonstration...
London Cloud Computing Meetup: From GigaSpaces to the Cloud - a demonstration...London Cloud Computing Meetup: From GigaSpaces to the Cloud - a demonstration...
London Cloud Computing Meetup: From GigaSpaces to the Cloud - a demonstration...
 
Maginatics @ SDC 2013: Architecting An Enterprise Storage Platform Using Obje...
Maginatics @ SDC 2013: Architecting An Enterprise Storage Platform Using Obje...Maginatics @ SDC 2013: Architecting An Enterprise Storage Platform Using Obje...
Maginatics @ SDC 2013: Architecting An Enterprise Storage Platform Using Obje...
 
Greenplum Architecture
Greenplum ArchitectureGreenplum Architecture
Greenplum Architecture
 
Apache ignite v1.3
Apache ignite v1.3Apache ignite v1.3
Apache ignite v1.3
 
No sql database
No sql databaseNo sql database
No sql database
 
kumarResume
kumarResumekumarResume
kumarResume
 
Efficient and scalable multitenant placement approach for in memory database ...
Efficient and scalable multitenant placement approach for in memory database ...Efficient and scalable multitenant placement approach for in memory database ...
Efficient and scalable multitenant placement approach for in memory database ...
 
U nit 1_dbms
U nit 1_dbmsU nit 1_dbms
U nit 1_dbms
 
مقدمة عن NoSQL بالعربي
مقدمة عن NoSQL بالعربيمقدمة عن NoSQL بالعربي
مقدمة عن NoSQL بالعربي
 
Data has a better idea the in-memory data grid
Data has a better idea   the in-memory data gridData has a better idea   the in-memory data grid
Data has a better idea the in-memory data grid
 
Relational databases vs Non-relational databases
Relational databases vs Non-relational databasesRelational databases vs Non-relational databases
Relational databases vs Non-relational databases
 
Big Data on Cloud Native Platform
Big Data on Cloud Native PlatformBig Data on Cloud Native Platform
Big Data on Cloud Native Platform
 
Big Data on Cloud Native Platform
Big Data on Cloud Native PlatformBig Data on Cloud Native Platform
Big Data on Cloud Native Platform
 
NOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQLNOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQL
 
NOSQL in big data is the not only structure langua.pdf
NOSQL in big data is the not only structure langua.pdfNOSQL in big data is the not only structure langua.pdf
NOSQL in big data is the not only structure langua.pdf
 
Slides: Relational to NoSQL Migration
Slides: Relational to NoSQL MigrationSlides: Relational to NoSQL Migration
Slides: Relational to NoSQL Migration
 

Último

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 

Último (20)

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 

Database Architecture - Case Study - SMS Gyan.pdf

  • 2. About Me Shyam Anand Senior Software Engineer at Google. Previously worked with several startups. Works on distributed systems, system architecture, etc. linkedin.com/in/shyamanand
  • 3. We’ll talk about databases. With a case-study of SMS Gyan. ● SMS Gyan was launched by Innoz in 2008. ● An SMS based answering engine, came to be known as “Internet on SMS”. SMS Introduction airtel SMS Gyan HTTP
  • 4. Database Systems Data modelling is perhaps the most important part of developing software. Decision on how to structure, store, and retrieve data can affect the entire application, throughout its life. There are several factors to consider while choosing a database, such as, ● Structure of the data ● Expected data volume ● Performance requirements
  • 5. Relational vs Non-Relational Databases Relational For structured data. Stores data in tables that may share information (and hence, “Relational”). Uses JOIN queries to access data in different tables. Performance tuning becomes necessary with large volumes of data. Relatively difficult to scale out. Lacks flexibility in how data is stored. Atomicity, Consistency, Isolation, and Durability (ACID) guarantees. Non-Relational For unstructured data (documents). No concept of tables, fields/columns. MongoDB, And Elasticsearch store data as JSON-like documents. Supports data locality. Can easily support very large volumes of data. Easier to scale out, because of native support for replication, sharding, etc. Can support changes to the structure of data stored, making it easier to modify the application layer. No transactions (typically), so no ACID guarantees. Some provide Eventual Consistency.
  • 6. Consistency or Availability? ● Network partitions will inevitably happen in a distributed system. ● Choosing between a relational vs non-relational db can boil down to this question.
  • 7. ● The first version was a simple PHP app with a MySQL database. ● Supported a few hundred users and a few hundred queries a day. SMS Gyan Telecom Operator mysql <network> backend smsgyan app
  • 8. MySQL ● A Relational Database Management System (RDBMS). ● One of the most popular databases. ● Free and open-source, easy to get started. ● Reliable and scalable.
  • 9. Data Modelling Need to store ● The queries from users ● The answers to the queries (as a local cache) ● User details (network operator, whether a subscriber, etc) phone network is_subscribed query result source query_ts 9876543210 airtel 1 MySQL MySQL is … wikipedia 2009-11-10 12:00:00
  • 10. Schema phone query query_ts 9876543210 MySQL 2009-11-10 12:00:00 phone network is_subscribed last_active 9876543210 airtel 1 2009-11-10 queries users query result source MySQL MySQL is an open-source ... wikipedia knowledge_base
  • 11. High volume of airtel 121 requests ● The application was receiving a large number of requests (> 1000 qps). ● Caused the database to become slow, and the requests to fail (SLA violation). Scaling App DB Airtel X X
  • 14. ● MySQL FULLTEXT index was used. ● The results were sometimes not accurate, especially for queries that are sentences or phrases. ● MySQL performance was deteriorating as the data volume was increasing. Improving search results query result source MySQL MySQL is an open-source... wikipedia queries
  • 15. ● Designed for really fast text searches. Supports stemming, ranking, etc. ● Data is stored as documents. Provides REST APIs to read and write data. ● Highly available, scalable, and (relatively) easy to configure. ● Natively supports sharding and replication. Elasticsearch smsgyan app Elasticsearch cluster
  • 16. Elasticsearch Cluster: Consists of one or more nodes. Node: An instance of ES. Index: A logical namespace, maps to one or more primary shards, and can have 0 or more replica shards. Document: A record stored in ES. Shard: A single low-level worker unit managed by ES. Primary Shard: Each document is stored in a primary shard. Replica Shard: A copy of a Primary shard. Each primary shard can have 0 or more replicas. Replicas help distribute ES’s load, and can help in failover if a primary shard is unavailable.
  • 17. Caching Pagination of results ● SMS replies put a limit on the length of content, so a whole wikipedia article would be returned as several pages. ● Users need to send SMS to retrieve each page.
  • 18. Redis ● A distributed, in-memory data structure store. ○ Can store simple key values, Sets, Lists, Ordered Lists, etc., and can perform operations such as Set union/intersection, push/pop to/from Lists, etc. ● Can be used as an in-memory key-value db, cache, and message broker. ● Durability is optional. ● Different function from the databases discussed earlier.
  • 19. Redis In SMS Gyan 1. Fetch query result (database, or source on internet) 2. Write the entire result into cache, with user’s phone number as key. 3. Extract a page (upto 240 characters) and send to user, remove the served page from the content in cache. 4. If user requests more pages, do step 3. 5. Clear the key if a. The user sends a different query, or b. There is no request from user for a specific period of time.