SlideShare une entreprise Scribd logo
1  sur  26
Télécharger pour lire hors ligne
Zing Me Web Chat Architect




              By Chau Nguyen Nhat Thanh
                ZingMe Technical Manager
                     Web Technical - VNG
Agenda

●
    About Zing Me
●
    Zing Me platform strategy
●
    Zing Me web chat architect
    ●
        Problem with real time message in HTTP
    ●
        Connection server
    ●
        Message server
    ●
        Online server
●
    Some statistic information
                                                 2
About Zing Me
SNS Platform
Updated stats
●   45M registered accounts
●   2.2M daily active users
●   7M monthly active users
●   > 500 servers (2 K cores)
    ●   70 DB servers, >60 Memcached servers
    ●   ~ 150 Web servers
    ●   40 servers for Hadoop farm
    ●   Others (storage, ...)
Zing Me Technology
●   Load balancing: HA proxy, LVS
●   Web server: Nginx, Lighttpd
●   Web caching: Squid, Varnish
●   Caching: Redis, Memcached, Membase
●   CDN: in progress
●   Programming language: PHP, C++,Java, Python,
    Bash script, Erlang
●   Searching: Solr, Lucene
●   DB: MySQL , Cassandra, HBase
●   Log system: Scriber + Hadoop
Zing Me platform strategy
●   Open platform
    ●   Open Social API
    ●   Open Auth
    ●   Zing Connect
    ●   http://open.me.zing.vn/
●   Open service
    ●   Cloud Memcache
    ●   Cloud Key Value Storage
    ●   Virtualization for Hosting Service
Zing Me platform strategy
●   Focus on communication tools:
    ●   Email: Zing mail
    ●   Private message
    ●   IM : ZingMe Web Chat
    ●   Notification: Zing Notification System
Zing Me Web Chat
     Architect
Frontend UI
Problem with realtime message
●   Realtime message in HTTP
    ●   Browser actively connect to web server
    ●   How can web server push the new message to the
        browser ?
    ●   COMET is the answer
●   COMET overview
    ●   Comet is a web application model in which a long-held
        HTTP request allows a web server to push data to a
        browser, without the browser explicitly requesting it
        (wikipedia)
    ●   Implementation: hiden iframe, ajax long-polling, script
        tag long polling
Frontend JS
●   2 developers in 4 months
●   Building from the scratch based on
    zmCore.js, a Zing Me homemade js
    framework
●   Using long-polling for pushing new messge
●   Get online friend list
●   Get last message
●   Verify session
Backend
●   Must scalable
●   Handle large number of connetions
●   Connection server handles the long-polling
    connection
●   Friend Online server keeps track online friends
●   Message Server stores the messages
●   Message Delivery Worker transfers messages from
    the Message Server to Connection Server
●   Channel Server maps the users with their
    connections
Web Chat Architect Overview
Connection Server
●   Must handle large number of concurrent
    connections ( > 100K connections)
●   Implement in C++
●   Using native EPOLL system call
●   NONBLOCKING mode for async IO
●   Dev in 8 months
Connection Server
            Implementation
●   Long polling
Connection Server
            Implementation
●   Keep connections until message come or
    timeout
●   Server must keep a large number of
    connections (C100K)
●   Use the same solution like memcached,
    haproxy
Connection Server
              Implementation
●   Why EPOLL?
    ●   General way to implement tcp servers is “one
        thread/process per connection”. But on high
        loads this approach can be not so efficient and
        we need to use another patterns of connection
        handling.(kovyri.net)
    ●   Need an asynchronous way
    ●   EPOLL is the solution
Connection Server
                   Implementation
●   Coding with EPOLL
    ●   Create specific file descriptor for epoll calls:
        epfd = epoll_create(EPOLL_QUEUE_LEN);
    ●   After first step you can add your descriptors to epoll with following call:
        static struct epoll_event ev;
        int client_sock;
         ...
        ev.events = EPOLLIN | EPOLLPRI | EPOLLERR | EPOLLHUP;
        ev.data.fd = client_sock;
        int res = epoll_ctl(epfd, EPOLL_CTL_ADD, client_sock, &ev);
Connection Server
                            Implementation
●   When all your descriptors will be added to epoll, your process can idle and wait to
    something to do with epoll’ed sockets:
     while (1) {
         // wait for something to do...
         int nfds = epoll_wait(epfd, events,
                               MAX_EPOLL_EVENTS_PER_RUN,
                               EPOLL_RUN_TIMEOUT);
         if (nfds < 0) die("Error in epoll_wait!");
         // for each ready socket
         for(int i = 0; i < nfds; i++) {
             int fd = events[i].data.fd;
             handle_io_on_socket(fd);
         }
     }
Friend Online Server
●   Hard to scale
●   Implement in C++
●   Using some cheats to define user online
●   Caching is hard
●   Dev in 1 month
Message Server
●   Store the messages
●   Implement in Java
●   Problem with memory usage
    ●   C++ version in progress
●   Notify new message by queue
●   Worker will deliver message to user by
    connection server
Web Chat statistic
Total message
Hourly stats
Q&A




Contact info:
         Chau Nguyen Nhat Thanh

       thanhcnn@vng.com.vn

       me.zing.vn/thanhcnn2000

Contenu connexe

Tendances

Experience lessons from architecture of zalo real time system
Experience lessons from architecture of zalo real time systemExperience lessons from architecture of zalo real time system
Experience lessons from architecture of zalo real time systemZalo_app
 
Web performance optimization - MercadoLibre
Web performance optimization - MercadoLibreWeb performance optimization - MercadoLibre
Web performance optimization - MercadoLibrePablo Moretti
 
Zing Database – Distributed Key-Value Database
Zing Database – Distributed Key-Value DatabaseZing Database – Distributed Key-Value Database
Zing Database – Distributed Key-Value Databasezingopen
 
Php & web server performace
Php & web server performacePhp & web server performace
Php & web server performaceTuyển Đoàn
 
Web Performance Part 3 "Server-side tips"
Web Performance Part 3  "Server-side tips"Web Performance Part 3  "Server-side tips"
Web Performance Part 3 "Server-side tips"Binary Studio
 
Optimising for Performance
Optimising for PerformanceOptimising for Performance
Optimising for Performancethomas_mb
 
2013 - Brian Stanley - Memcached, Cached all the things
2013 - Brian Stanley - Memcached, Cached all the things2013 - Brian Stanley - Memcached, Cached all the things
2013 - Brian Stanley - Memcached, Cached all the thingsPHP Conference Argentina
 
NGINX for Application Delivery & Acceleration
NGINX for Application Delivery & AccelerationNGINX for Application Delivery & Acceleration
NGINX for Application Delivery & AccelerationNGINX, Inc.
 
ASP.NET Scalability - WebDD
ASP.NET Scalability - WebDDASP.NET Scalability - WebDD
ASP.NET Scalability - WebDDPhil Pursglove
 
From One to a Cluster
From One to a ClusterFrom One to a Cluster
From One to a Clusterguestd34230
 
ASP.NET Scalability - VBUG London
ASP.NET Scalability - VBUG LondonASP.NET Scalability - VBUG London
ASP.NET Scalability - VBUG LondonPhil Pursglove
 
Warsaw MuleSoft Meetup #12 Effective Streaming
Warsaw MuleSoft Meetup #12 Effective StreamingWarsaw MuleSoft Meetup #12 Effective Streaming
Warsaw MuleSoft Meetup #12 Effective StreamingPatryk Bandurski
 
Benchmarking NGINX for Accuracy and Results
Benchmarking NGINX for Accuracy and ResultsBenchmarking NGINX for Accuracy and Results
Benchmarking NGINX for Accuracy and ResultsNGINX, Inc.
 

Tendances (16)

Experience lessons from architecture of zalo real time system
Experience lessons from architecture of zalo real time systemExperience lessons from architecture of zalo real time system
Experience lessons from architecture of zalo real time system
 
Web performance optimization - MercadoLibre
Web performance optimization - MercadoLibreWeb performance optimization - MercadoLibre
Web performance optimization - MercadoLibre
 
Zing Database – Distributed Key-Value Database
Zing Database – Distributed Key-Value DatabaseZing Database – Distributed Key-Value Database
Zing Database – Distributed Key-Value Database
 
SPDY @Zynga
SPDY @ZyngaSPDY @Zynga
SPDY @Zynga
 
Php & web server performace
Php & web server performacePhp & web server performace
Php & web server performace
 
Web Performance Part 3 "Server-side tips"
Web Performance Part 3  "Server-side tips"Web Performance Part 3  "Server-side tips"
Web Performance Part 3 "Server-side tips"
 
Optimising for Performance
Optimising for PerformanceOptimising for Performance
Optimising for Performance
 
2013 - Brian Stanley - Memcached, Cached all the things
2013 - Brian Stanley - Memcached, Cached all the things2013 - Brian Stanley - Memcached, Cached all the things
2013 - Brian Stanley - Memcached, Cached all the things
 
NGINX for Application Delivery & Acceleration
NGINX for Application Delivery & AccelerationNGINX for Application Delivery & Acceleration
NGINX for Application Delivery & Acceleration
 
WordCamp RVA
WordCamp RVAWordCamp RVA
WordCamp RVA
 
ASP.NET Scalability - WebDD
ASP.NET Scalability - WebDDASP.NET Scalability - WebDD
ASP.NET Scalability - WebDD
 
From One to a Cluster
From One to a ClusterFrom One to a Cluster
From One to a Cluster
 
How fast is it?
How fast is it?How fast is it?
How fast is it?
 
ASP.NET Scalability - VBUG London
ASP.NET Scalability - VBUG LondonASP.NET Scalability - VBUG London
ASP.NET Scalability - VBUG London
 
Warsaw MuleSoft Meetup #12 Effective Streaming
Warsaw MuleSoft Meetup #12 Effective StreamingWarsaw MuleSoft Meetup #12 Effective Streaming
Warsaw MuleSoft Meetup #12 Effective Streaming
 
Benchmarking NGINX for Accuracy and Results
Benchmarking NGINX for Accuracy and ResultsBenchmarking NGINX for Accuracy and Results
Benchmarking NGINX for Accuracy and Results
 

En vedette

Building ZingMe News Feed System
Building ZingMe News Feed SystemBuilding ZingMe News Feed System
Building ZingMe News Feed SystemChau Thanh
 
Design a scalable social network: Problems and solutions
Design a scalable social network: Problems and solutionsDesign a scalable social network: Problems and solutions
Design a scalable social network: Problems and solutionsChau Thanh
 
Inside Zalo: Developing a mobile messenger for the audience of millions - VN ...
Inside Zalo: Developing a mobile messenger for the audience of millions - VN ...Inside Zalo: Developing a mobile messenger for the audience of millions - VN ...
Inside Zalo: Developing a mobile messenger for the audience of millions - VN ...Zalo_app
 
Architecture Patterns - Open Discussion
Architecture Patterns - Open DiscussionArchitecture Patterns - Open Discussion
Architecture Patterns - Open DiscussionNguyen Tung
 
facebook architecture for 600M users
facebook architecture for 600M usersfacebook architecture for 600M users
facebook architecture for 600M usersJongyoon Choi
 
Developing High Performance Application with Aerospike & Go
Developing High Performance Application with Aerospike & GoDeveloping High Performance Application with Aerospike & Go
Developing High Performance Application with Aerospike & GoChris Stivers
 
IoT and developer chances
IoT and developer chancesIoT and developer chances
IoT and developer chancesChau Thanh
 
Design a scalable social network: Problems and Solutions
Design a scalable social network: Problems and SolutionsDesign a scalable social network: Problems and Solutions
Design a scalable social network: Problems and SolutionsChau Thanh
 
Live Analytics with Go & Aerospike
Live Analytics with Go & AerospikeLive Analytics with Go & Aerospike
Live Analytics with Go & AerospikeNick Manning
 
Zing me overview
Zing me overviewZing me overview
Zing me overviewOhay TV
 
Zing me credential
Zing me credentialZing me credential
Zing me credentialzingopen
 
Zing me build brand engagement with zing me aug 2011
Zing me   build brand engagement with zing me aug 2011Zing me   build brand engagement with zing me aug 2011
Zing me build brand engagement with zing me aug 2011Binny Ngo
 
megastar - zing me social network story
megastar - zing me social network storymegastar - zing me social network story
megastar - zing me social network storyzingopen
 
Zing Me Launch Meetup July 2011
Zing Me Launch Meetup July 2011Zing Me Launch Meetup July 2011
Zing Me Launch Meetup July 2011Nguyen Trong
 
ZING: the Next Generation of Z39.50
ZING: the Next Generation of Z39.50ZING: the Next Generation of Z39.50
ZING: the Next Generation of Z39.50horvadam
 
Giving Your Presentations Zing!
Giving Your Presentations Zing!Giving Your Presentations Zing!
Giving Your Presentations Zing!Daniel J. Lewis
 
Zing Me - Open Platform Introduction
Zing Me - Open Platform IntroductionZing Me - Open Platform Introduction
Zing Me - Open Platform Introductionkhaivq
 
Getting The Most Out Of Your Flash/SSDs
Getting The Most Out Of Your Flash/SSDsGetting The Most Out Of Your Flash/SSDs
Getting The Most Out Of Your Flash/SSDsAerospike, Inc.
 
Buiding and Deploying SaaS with WSO2 as as-a-Service
Buiding and Deploying SaaS with WSO2 as as-a-ServiceBuiding and Deploying SaaS with WSO2 as as-a-Service
Buiding and Deploying SaaS with WSO2 as as-a-ServiceWSO2
 
Distributing Data The Aerospike Way
Distributing Data The Aerospike WayDistributing Data The Aerospike Way
Distributing Data The Aerospike WayAerospike, Inc.
 

En vedette (20)

Building ZingMe News Feed System
Building ZingMe News Feed SystemBuilding ZingMe News Feed System
Building ZingMe News Feed System
 
Design a scalable social network: Problems and solutions
Design a scalable social network: Problems and solutionsDesign a scalable social network: Problems and solutions
Design a scalable social network: Problems and solutions
 
Inside Zalo: Developing a mobile messenger for the audience of millions - VN ...
Inside Zalo: Developing a mobile messenger for the audience of millions - VN ...Inside Zalo: Developing a mobile messenger for the audience of millions - VN ...
Inside Zalo: Developing a mobile messenger for the audience of millions - VN ...
 
Architecture Patterns - Open Discussion
Architecture Patterns - Open DiscussionArchitecture Patterns - Open Discussion
Architecture Patterns - Open Discussion
 
facebook architecture for 600M users
facebook architecture for 600M usersfacebook architecture for 600M users
facebook architecture for 600M users
 
Developing High Performance Application with Aerospike & Go
Developing High Performance Application with Aerospike & GoDeveloping High Performance Application with Aerospike & Go
Developing High Performance Application with Aerospike & Go
 
IoT and developer chances
IoT and developer chancesIoT and developer chances
IoT and developer chances
 
Design a scalable social network: Problems and Solutions
Design a scalable social network: Problems and SolutionsDesign a scalable social network: Problems and Solutions
Design a scalable social network: Problems and Solutions
 
Live Analytics with Go & Aerospike
Live Analytics with Go & AerospikeLive Analytics with Go & Aerospike
Live Analytics with Go & Aerospike
 
Zing me overview
Zing me overviewZing me overview
Zing me overview
 
Zing me credential
Zing me credentialZing me credential
Zing me credential
 
Zing me build brand engagement with zing me aug 2011
Zing me   build brand engagement with zing me aug 2011Zing me   build brand engagement with zing me aug 2011
Zing me build brand engagement with zing me aug 2011
 
megastar - zing me social network story
megastar - zing me social network storymegastar - zing me social network story
megastar - zing me social network story
 
Zing Me Launch Meetup July 2011
Zing Me Launch Meetup July 2011Zing Me Launch Meetup July 2011
Zing Me Launch Meetup July 2011
 
ZING: the Next Generation of Z39.50
ZING: the Next Generation of Z39.50ZING: the Next Generation of Z39.50
ZING: the Next Generation of Z39.50
 
Giving Your Presentations Zing!
Giving Your Presentations Zing!Giving Your Presentations Zing!
Giving Your Presentations Zing!
 
Zing Me - Open Platform Introduction
Zing Me - Open Platform IntroductionZing Me - Open Platform Introduction
Zing Me - Open Platform Introduction
 
Getting The Most Out Of Your Flash/SSDs
Getting The Most Out Of Your Flash/SSDsGetting The Most Out Of Your Flash/SSDs
Getting The Most Out Of Your Flash/SSDs
 
Buiding and Deploying SaaS with WSO2 as as-a-Service
Buiding and Deploying SaaS with WSO2 as as-a-ServiceBuiding and Deploying SaaS with WSO2 as as-a-Service
Buiding and Deploying SaaS with WSO2 as as-a-Service
 
Distributing Data The Aerospike Way
Distributing Data The Aerospike WayDistributing Data The Aerospike Way
Distributing Data The Aerospike Way
 

Similaire à Zing Me Real Time Web Chat Architect

Zingme practice for building scalable website with PHP
Zingme practice for building scalable website with PHPZingme practice for building scalable website with PHP
Zingme practice for building scalable website with PHPVõ Duy Tuấn
 
zingmepracticeforbuildingscalablewebsitewithphp
zingmepracticeforbuildingscalablewebsitewithphpzingmepracticeforbuildingscalablewebsitewithphp
zingmepracticeforbuildingscalablewebsitewithphphazzaz
 
01 zingme practice for building scalable website with php
01 zingme practice for building scalable website with php01 zingme practice for building scalable website with php
01 zingme practice for building scalable website with phpNguyen Duc Phu
 
Node.js Presentation
Node.js PresentationNode.js Presentation
Node.js PresentationExist
 
Zero Downtime JEE Architectures
Zero Downtime JEE ArchitecturesZero Downtime JEE Architectures
Zero Downtime JEE ArchitecturesAlexander Penev
 
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a Month
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a MonthUSENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a Month
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a MonthNicolas Brousse
 
Php Inside - confoo 2011 - Derick Rethans
Php Inside -  confoo 2011 - Derick RethansPhp Inside -  confoo 2011 - Derick Rethans
Php Inside - confoo 2011 - Derick RethansBachkoutou Toutou
 
Massively Scaled High Performance Web Services with PHP
Massively Scaled High Performance Web Services with PHPMassively Scaled High Performance Web Services with PHP
Massively Scaled High Performance Web Services with PHPDemin Yin
 
Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...
Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...
Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...David Geurts
 
How to connect 1980 and 2018
How to connect 1980 and 2018How to connect 1980 and 2018
How to connect 1980 and 2018Matthieu Kern
 
HTML5/JavaScript Communication APIs - DPC 2014
HTML5/JavaScript Communication APIs - DPC 2014HTML5/JavaScript Communication APIs - DPC 2014
HTML5/JavaScript Communication APIs - DPC 2014Christian Wenz
 
Integrating Node.js with PHP
Integrating Node.js with PHPIntegrating Node.js with PHP
Integrating Node.js with PHPLee Boynton
 

Similaire à Zing Me Real Time Web Chat Architect (20)

Monkey Server
Monkey ServerMonkey Server
Monkey Server
 
Zingme practice for building scalable website with PHP
Zingme practice for building scalable website with PHPZingme practice for building scalable website with PHP
Zingme practice for building scalable website with PHP
 
zingmepracticeforbuildingscalablewebsitewithphp
zingmepracticeforbuildingscalablewebsitewithphpzingmepracticeforbuildingscalablewebsitewithphp
zingmepracticeforbuildingscalablewebsitewithphp
 
01 zingme practice for building scalable website with php
01 zingme practice for building scalable website with php01 zingme practice for building scalable website with php
01 zingme practice for building scalable website with php
 
Nodejs
NodejsNodejs
Nodejs
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
Full stack development
Full stack developmentFull stack development
Full stack development
 
Node.js scaling in highload
Node.js scaling in highloadNode.js scaling in highload
Node.js scaling in highload
 
Node.js Presentation
Node.js PresentationNode.js Presentation
Node.js Presentation
 
ServerSentEvents.pdf
ServerSentEvents.pdfServerSentEvents.pdf
ServerSentEvents.pdf
 
Netty training
Netty trainingNetty training
Netty training
 
Zero Downtime JEE Architectures
Zero Downtime JEE ArchitecturesZero Downtime JEE Architectures
Zero Downtime JEE Architectures
 
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a Month
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a MonthUSENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a Month
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a Month
 
Netty training
Netty trainingNetty training
Netty training
 
Php Inside - confoo 2011 - Derick Rethans
Php Inside -  confoo 2011 - Derick RethansPhp Inside -  confoo 2011 - Derick Rethans
Php Inside - confoo 2011 - Derick Rethans
 
Massively Scaled High Performance Web Services with PHP
Massively Scaled High Performance Web Services with PHPMassively Scaled High Performance Web Services with PHP
Massively Scaled High Performance Web Services with PHP
 
Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...
Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...
Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...
 
How to connect 1980 and 2018
How to connect 1980 and 2018How to connect 1980 and 2018
How to connect 1980 and 2018
 
HTML5/JavaScript Communication APIs - DPC 2014
HTML5/JavaScript Communication APIs - DPC 2014HTML5/JavaScript Communication APIs - DPC 2014
HTML5/JavaScript Communication APIs - DPC 2014
 
Integrating Node.js with PHP
Integrating Node.js with PHPIntegrating Node.js with PHP
Integrating Node.js with PHP
 

Dernier

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 

Dernier (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Zing Me Real Time Web Chat Architect

  • 1. Zing Me Web Chat Architect By Chau Nguyen Nhat Thanh ZingMe Technical Manager Web Technical - VNG
  • 2. Agenda ● About Zing Me ● Zing Me platform strategy ● Zing Me web chat architect ● Problem with real time message in HTTP ● Connection server ● Message server ● Online server ● Some statistic information 2
  • 5. Updated stats ● 45M registered accounts ● 2.2M daily active users ● 7M monthly active users ● > 500 servers (2 K cores) ● 70 DB servers, >60 Memcached servers ● ~ 150 Web servers ● 40 servers for Hadoop farm ● Others (storage, ...)
  • 6. Zing Me Technology ● Load balancing: HA proxy, LVS ● Web server: Nginx, Lighttpd ● Web caching: Squid, Varnish ● Caching: Redis, Memcached, Membase ● CDN: in progress ● Programming language: PHP, C++,Java, Python, Bash script, Erlang ● Searching: Solr, Lucene ● DB: MySQL , Cassandra, HBase ● Log system: Scriber + Hadoop
  • 7. Zing Me platform strategy ● Open platform ● Open Social API ● Open Auth ● Zing Connect ● http://open.me.zing.vn/ ● Open service ● Cloud Memcache ● Cloud Key Value Storage ● Virtualization for Hosting Service
  • 8. Zing Me platform strategy ● Focus on communication tools: ● Email: Zing mail ● Private message ● IM : ZingMe Web Chat ● Notification: Zing Notification System
  • 9. Zing Me Web Chat Architect
  • 11. Problem with realtime message ● Realtime message in HTTP ● Browser actively connect to web server ● How can web server push the new message to the browser ? ● COMET is the answer ● COMET overview ● Comet is a web application model in which a long-held HTTP request allows a web server to push data to a browser, without the browser explicitly requesting it (wikipedia) ● Implementation: hiden iframe, ajax long-polling, script tag long polling
  • 12. Frontend JS ● 2 developers in 4 months ● Building from the scratch based on zmCore.js, a Zing Me homemade js framework ● Using long-polling for pushing new messge ● Get online friend list ● Get last message ● Verify session
  • 13. Backend ● Must scalable ● Handle large number of connetions ● Connection server handles the long-polling connection ● Friend Online server keeps track online friends ● Message Server stores the messages ● Message Delivery Worker transfers messages from the Message Server to Connection Server ● Channel Server maps the users with their connections
  • 14. Web Chat Architect Overview
  • 15. Connection Server ● Must handle large number of concurrent connections ( > 100K connections) ● Implement in C++ ● Using native EPOLL system call ● NONBLOCKING mode for async IO ● Dev in 8 months
  • 16. Connection Server Implementation ● Long polling
  • 17. Connection Server Implementation ● Keep connections until message come or timeout ● Server must keep a large number of connections (C100K) ● Use the same solution like memcached, haproxy
  • 18. Connection Server Implementation ● Why EPOLL? ● General way to implement tcp servers is “one thread/process per connection”. But on high loads this approach can be not so efficient and we need to use another patterns of connection handling.(kovyri.net) ● Need an asynchronous way ● EPOLL is the solution
  • 19. Connection Server Implementation ● Coding with EPOLL ● Create specific file descriptor for epoll calls: epfd = epoll_create(EPOLL_QUEUE_LEN); ● After first step you can add your descriptors to epoll with following call: static struct epoll_event ev; int client_sock; ... ev.events = EPOLLIN | EPOLLPRI | EPOLLERR | EPOLLHUP; ev.data.fd = client_sock; int res = epoll_ctl(epfd, EPOLL_CTL_ADD, client_sock, &ev);
  • 20. Connection Server Implementation ● When all your descriptors will be added to epoll, your process can idle and wait to something to do with epoll’ed sockets: while (1) { // wait for something to do... int nfds = epoll_wait(epfd, events, MAX_EPOLL_EVENTS_PER_RUN, EPOLL_RUN_TIMEOUT); if (nfds < 0) die("Error in epoll_wait!"); // for each ready socket for(int i = 0; i < nfds; i++) { int fd = events[i].data.fd; handle_io_on_socket(fd); } }
  • 21. Friend Online Server ● Hard to scale ● Implement in C++ ● Using some cheats to define user online ● Caching is hard ● Dev in 1 month
  • 22. Message Server ● Store the messages ● Implement in Java ● Problem with memory usage ● C++ version in progress ● Notify new message by queue ● Worker will deliver message to user by connection server
  • 26. Q&A Contact info: Chau Nguyen Nhat Thanh thanhcnn@vng.com.vn me.zing.vn/thanhcnn2000