Michael
Basic: High performance
system building
contact: michael@cinnamon.is
Introduction
❖ Graduated: Ha Noi University of Science and
Technology - Software Engineer - 2010
❖ Got No.3, Viet Name Talent in IT field - 2011.
❖ from 2007 - 2013: work at Med-Aid as Team Leader, a
partner of Prowess.
❖ From 2013 - Now: working at Cinnamon as Software
Architecture Leader.
Main points researching
❖ High performance system building
❖ Data mining
❖ Artificial Intelligent
How to build high performance
system?
Normal system architecture
database
System
logic
Server side
Third
party
system
Client side
Problem come from here!!!
Real use case
❖ Social network
❖ one user have:
followers, followings,
posts.
❖ …
Server side - Database
Database issues?
Queries
So slow
- Multiple queries in one request
- Each query take time to run
System run slow
Database solution?
Queries
So slow
❖ Set Index for all important fields
❖ Optimise number of queries on each request / task
❖ Anything else?
Caching solution
❖ always check if needed data exist on cache or not
❖ if exist —> get from cache.
❖ if not —> query from DB and add to cache too.
Logic
CacheExist?
Query if not exist in cache
Update cache for
each query
Caching solution
❖ Redis cache: https://redis.io
❖ Memcache: https://memcached.org
❖ …
Example
❖ If User 1111 create new post which has ID = cccc —>
system need update that post id for all his following
users.
❖ How will you do?
UserId PostId
2222 aaaa
2222 bbbb
3333 aaaa
Feeds table
UserId FollowingID
1111 2222
1111 3333
1111 4444
Following table
Normal way
❖ Step 1: Get all following user’s ids from 1111. (0.2s)
❖ Step 2: For each following users:
❖ Step 2.1: Insert new record on Feeds table for that
user. (0.2s)
❖ If 1111 have 50 following —> system will take: 0.2 +
50*0.2 = 10.2s !!!! —> Too slow!!!
Improved way
❖ Step 1: Get all following user’s ids from 1111. (0.2s)
❖ Step 2: For each following users:
❖ Step 2.1: Create feed’s record for each user. (so small
time)
❖ Step 3: Insert all records in one command. (0.3s)
❖ If 1111 have 50 following —> system will take: 0.2 + 0.3
= 0.5s !!!! —>Much faster!!!
Apply cache?
❖ Step 1: Get all following user’s ids from cache. (0.002s)
❖ Step 2: For each following users:
❖ Step 2.1: Create feed’s record for each user. (so small
time)
❖ Step 3: Insert all records in one command. (0.3s)
❖ Step 4: Insert all records to cache. (0.003s)
❖ If 1111 have 50 following —> system will take: 0.002 +
0.3 + 0.003 = 0.305s !!!! —>Much faster!!!
Server side - Logic
Server side - Logic
❖ POST / PUT/ DELETE
❖ GET
Third
party
Data database
Logic
SLOW
Third party
Data
Logic
SLOW
database
Third party
POST/PUT/DELETE issues?
Tasks need to
do
Database
Third Party
Request
Response time > 2s
Too much tasks need to do
POST/PUT/DELETE solution?
Database
Third Party
Request
Response time < 500 ms
Realtime
Background
How background work?
❖ It should be use message queue system.
❖ some message queue system: RabbitMQ, ZeroMQ,
Kafka, Redis PubSub…
Main
server
Message
queue
Background
server 1
Background
server 2
Messaging queue technology
❖ PubSub pattern (AMQP, MQTT…)
Can we make Realtime task run
faster?
Caching for realtime task
Task 1
Access DB
Task 2
Update DB
….
OLD way
Task 1
Access Cache
Task 2
Update Cache
….
NEW way
Task n Task n
Example
❖ when new post created by user 1111 —> push
notification for all following users about that.
❖ How will you do?
Normal way
❖ User create new post
❖ Get all following user ids.
❖ for each following user:
❖ Insert new record to Feed table
❖ call push notification method to send push
notification.
❖ Return result.
So take time
here
Improved way
❖ User create new post
❖ Get all following user ids.
❖ Insert all records in one command into Feed table
❖ For each following users:
❖ Add one task to message queue to run in background.
❖ Return result.
So Fast
GET issues?
Data queries
Database
Third Party
Request
Response time > 2s
Too much thing need to format
Format
response data
Too slow
Solution
Data queries
Database
Third Party
Request
Response time <500ms
Format
response data
Cache
How to make cache data optimise for GET apis?
API get
list of
following
users
Get following
Ids
Format
following
objects
Following
cache
Following
formatted
cache
Always have cache object for any data we need for our apis.
How to apply them to your
project / company?
Modulation
Modulation
Libs
Micro services
Libs
Cache
DB
Access
Cache
Access
Repository Base
Your Repository
Here
Micro-service
Main
logic
Message
queue
Background
server
Background
server
….
Thanks!
Questions?
michael@cinnamon.is

More Related Content

PPT
PPTX
Midterm presentation
PPTX
Introduction to Redis and its features.pptx
KEY
Micro-Blogging for The Enterprise (MongoDB)
PDF
Scaling Twitter
PDF
Scaling Twitter 12758
PDF
Top5 scalabilityissues withappendix
PDF
Building and deploying large scale real time news system with my sql and dist...
Midterm presentation
Introduction to Redis and its features.pptx
Micro-Blogging for The Enterprise (MongoDB)
Scaling Twitter
Scaling Twitter 12758
Top5 scalabilityissues withappendix
Building and deploying large scale real time news system with my sql and dist...

Similar to [Case Simulation Workshop] Michael Evans - High performance system building (20)

PDF
Startup DevOps - Jon Milsom Pitchero - Leeds DevOps - August 2014
PPTX
Simplify Complex Query with CQRS
PDF
Five steps perform_2013
PPTX
Distributed Cache with dot microservices
PDF
Building zing me news feed system
PPTX
Couchbase presentation
PDF
PDF
Building ZingMe News Feed System
PDF
Celery: The Distributed Task Queue
PDF
System Design.pdf
PDF
System design handwritten notes guidance
PDF
Creating social features at BranchOut using MongoDB
PDF
Top5 scalabilityissues
PPTX
MSFT Dumaguete 061616 - Building High Performance Apps
PDF
Improving The Performance of Your Web App
PDF
Tweaking performance on high-load projects
PPTX
Data Caching Evolution - the SafePeak deck from webcast 2014-04-24
PDF
Google Devfest 2009 Argentina - Intro to Appengine
PDF
Storage, retreival and process of continuous streaming data in a widearea fre...
PDF
Wide area frequency easurement system iitb
Startup DevOps - Jon Milsom Pitchero - Leeds DevOps - August 2014
Simplify Complex Query with CQRS
Five steps perform_2013
Distributed Cache with dot microservices
Building zing me news feed system
Couchbase presentation
Building ZingMe News Feed System
Celery: The Distributed Task Queue
System Design.pdf
System design handwritten notes guidance
Creating social features at BranchOut using MongoDB
Top5 scalabilityissues
MSFT Dumaguete 061616 - Building High Performance Apps
Improving The Performance of Your Web App
Tweaking performance on high-load projects
Data Caching Evolution - the SafePeak deck from webcast 2014-04-24
Google Devfest 2009 Argentina - Intro to Appengine
Storage, retreival and process of continuous streaming data in a widearea fre...
Wide area frequency easurement system iitb
Ad

More from Nexus FrontierTech (20)

PPTX
[Executive Lounge Talk] Digital Transformation Journey
PDF
[AI series Talk #2] From PoC to Production - A Case Study
PDF
[AI Series Talk #2] Moving AI from PoC Stage to Production
PDF
[VFS 2019] Introduction to GANs - Pixta Vietnam
PPTX
[VFS 2019] Enabling Young Generation for Future - AWS Vietnam User Group
PPTX
[VFS 2019] Building chatbot with RASA
PPTX
[VFS 2019] Vietnamese Speech-to-Text: Applications and Product
PDF
[VFS 2019] How AI Will Innovate Recruitment
PPTX
[VFS 2019] AI in Finance
PPTX
[VFS 2019] Preventive Approach to Designing and Selling Healthy AI System
PDF
[VFS 2019] Phương pháp phát hiện bất thường bằng học máy
PDF
[VFS 2019] OCR Techniques for Digital Transformation Evolution
PPTX
[VFS 2019] Human Activity Recognition Approaches
PPTX
[VFS 2019] Aimesoft Solutions
PPTX
[VFS 2019] Datamart Introduction (brief)
PDF
[VFS 2019] Data Strategy for Vietnamese Businesses to Levarage AI
PPTX
[VFS 2019] AI for Banks
PDF
[VFS 2019] Digital Solution for Enterprises: 24/7 A.I English Speaking Coach
PDF
[VFS 2019] Project Management for AI-based Product - A Better Approach
PDF
[VFS 2019] AI Ecosystem transition from zero to hero - case study by rubikAI
[Executive Lounge Talk] Digital Transformation Journey
[AI series Talk #2] From PoC to Production - A Case Study
[AI Series Talk #2] Moving AI from PoC Stage to Production
[VFS 2019] Introduction to GANs - Pixta Vietnam
[VFS 2019] Enabling Young Generation for Future - AWS Vietnam User Group
[VFS 2019] Building chatbot with RASA
[VFS 2019] Vietnamese Speech-to-Text: Applications and Product
[VFS 2019] How AI Will Innovate Recruitment
[VFS 2019] AI in Finance
[VFS 2019] Preventive Approach to Designing and Selling Healthy AI System
[VFS 2019] Phương pháp phát hiện bất thường bằng học máy
[VFS 2019] OCR Techniques for Digital Transformation Evolution
[VFS 2019] Human Activity Recognition Approaches
[VFS 2019] Aimesoft Solutions
[VFS 2019] Datamart Introduction (brief)
[VFS 2019] Data Strategy for Vietnamese Businesses to Levarage AI
[VFS 2019] AI for Banks
[VFS 2019] Digital Solution for Enterprises: 24/7 A.I English Speaking Coach
[VFS 2019] Project Management for AI-based Product - A Better Approach
[VFS 2019] AI Ecosystem transition from zero to hero - case study by rubikAI
Ad

Recently uploaded (20)

PDF
August Patch Tuesday
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PDF
Getting Started with Data Integration: FME Form 101
PDF
Architecture types and enterprise applications.pdf
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
Hindi spoken digit analysis for native and non-native speakers
PPTX
Web Crawler for Trend Tracking Gen Z Insights.pptx
PDF
Hybrid model detection and classification of lung cancer
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
Developing a website for English-speaking practice to English as a foreign la...
PPT
What is a Computer? Input Devices /output devices
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
August Patch Tuesday
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Enhancing emotion recognition model for a student engagement use case through...
NewMind AI Weekly Chronicles – August ’25 Week III
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
Assigned Numbers - 2025 - Bluetooth® Document
sustainability-14-14877-v2.pddhzftheheeeee
Getting Started with Data Integration: FME Form 101
Architecture types and enterprise applications.pdf
Taming the Chaos: How to Turn Unstructured Data into Decisions
Hindi spoken digit analysis for native and non-native speakers
Web Crawler for Trend Tracking Gen Z Insights.pptx
Hybrid model detection and classification of lung cancer
DP Operators-handbook-extract for the Mautical Institute
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Benefits of Physical activity for teenagers.pptx
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Developing a website for English-speaking practice to English as a foreign la...
What is a Computer? Input Devices /output devices
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...

[Case Simulation Workshop] Michael Evans - High performance system building