12
Lessons from building backend for mobile app UBus - Tim xe khach using NoSQL HaNV2, HieuBQ @UBus - Tìm xe khách, 2016 1

Tech Talk #4 : Lessons from building backend for mobile app UBus - Nguyễn Việt Hà

Embed Size (px)

Citation preview

Page 1: Tech Talk #4 : Lessons from building backend for mobile app UBus - Nguyễn Việt Hà

Lessons from building backend for mobile app UBus - Tim xe khachusing NoSQL

HaNV2, HieuBQ @UBus - Tìm xe khách, 20161

Page 2: Tech Talk #4 : Lessons from building backend for mobile app UBus - Nguyễn Việt Hà

• 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

Page 3: Tech Talk #4 : Lessons from building backend for mobile app UBus - Nguyễn Việt Hà

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

Page 4: Tech Talk #4 : Lessons from building backend for mobile app UBus - Nguyễn Việt Hà

Data complexity

Trip

DriverOperator

Bus

Passenger

Location data

Ticket

Page 5: Tech Talk #4 : Lessons from building backend for mobile app UBus - Nguyễn Việt Hà

• Fast response

• Serve many connections (concurrency)

• Fast development speed

• Easy to maintain

Requirements

Page 6: Tech Talk #4 : Lessons from building backend for mobile app UBus - Nguyễn Việt Hà

How we’ve been doing it

User User2Tickets Ticket

DBManagers

… …

API

Clients

UbusBackend

Page 7: Tech Talk #4 : Lessons from building backend for mobile app UBus - Nguyễn Việt Hà

• 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

Page 8: Tech Talk #4 : Lessons from building backend for mobile app UBus - Nguyễn Việt Hà

• 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

Page 9: Tech Talk #4 : Lessons from building backend for mobile app UBus - Nguyễn Việt Hà

• Building / maintaining complex queries that have

many constraints:

○ Handling join by ourselves

○ Require clearly understanding the system

The difficult parts

Page 10: Tech Talk #4 : Lessons from building backend for mobile app UBus - Nguyễn Việt Hà

• 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

Page 11: Tech Talk #4 : Lessons from building backend for mobile app UBus - Nguyễn Việt Hà

• NoSQL is SUPER fast

• Good Concurrency

• Flexible data model

• Building backend is not very hard

• Maintainability (good and bad)

What we have learnt

Page 12: Tech Talk #4 : Lessons from building backend for mobile app UBus - Nguyễn Việt Hà

Q&A