Lessons from building backend for mobile app UBus - Tim xe khach using NoSQL HaNV2, HieuBQ @UBus - Tìm xe khách, 2016 1
Lessons from building backend for mobile app UBus - Tim xe khachusing NoSQL
HaNV2, HieuBQ @UBus - Tìm xe khách, 20161
• Mobile application helps passengers search and book intercity buses (long range buses)
• Online management system for operators and companion application for drivers
• Using NoSQL for storing data on server side
UBus - Tìm xe khách
UBus - Tìm xe khách
• Get notifications• Contact, locate and pickup• Manage passenger
Create and manage• Schedules, Trips• Drivers and buses
• Search bus• Book ticket NoSQL
Ubus System
Data complexity
Trip
DriverOperator
Bus
Passenger
Location data
Ticket
• Fast response
• Serve many connections (concurrency)
• Fast development speed
• Easy to maintain
Requirements
How we’ve been doing it
User User2Tickets Ticket
DBManagers
… …
API
Clients
UbusBackend
• Build our own Key - Value storage
• Each data collection is stored in one Key-Value storage
module
• 2 Type of storage services: Object storage and Relations
storage (reusable)
• Queries (CRUD) is implemented in code of a manager
service (or rest API but should keep API simple)
How we’ve been doing it
• Most queries are simple use timestamp or id to
access data
• Query linked data on many different storage
services is acceptable thank to instant response of
key-value
The easy parts
• Building / maintaining complex queries that have
many constraints:
○ Handling join by ourselves
○ Require clearly understanding the system
The difficult parts
• Examples and solutions
○ Index and Search Buses
■ Use matching instead
■ Get all data to filter
■ Under 150ms for uncached search query
○ List ticket of user with paging, ordered by
departure time
■ Nested key - value
Complex Queries examples
• NoSQL is SUPER fast
• Good Concurrency
• Flexible data model
• Building backend is not very hard
• Maintainability (good and bad)
What we have learnt
Q&A