SlideShare a Scribd company logo
Node.js Scaling in Highload
Timur Shemsedinov
KPI, Metarhia
You will rewrite all your code to reach each level
● 100 connections anyhow
● <50k connections single process
● ~500k connections single server
● >1 mln. connections single with opt. or cloud
● >2,5 mln. connections multiple servers
● >10 mln. connections clusterware or cloud
Scaling and performance factors:
● JavaScript, V8
● Node.js, libuv
● Code style and patterns
● Architectural decisions
● Dependencies
JavaScript is...
● Implemented and available everywhere
● Most common and widespread language
● Minimalistic syntax
● Libraries, community: NPM, Github and Stackoverflow
● Patterns: streams, factories, observers, queues, etc.
● Techniques: lambdas, closures, mixins, chaining, functors...
JavaScript is...
● Unpredictable optimizations in V8
● Async, blocking, long loops & recursion
● The Tower of Babel
● Crap in NPM & idiots in community
● Multiparadigm approach isn’t so easy
● Problems: mixins, poor types, change built-in classes...
Node.js is...
● Asynchronous I/O, libuv, streams
● V8, stat optimization, hidden classes...
● Production ready infrastructure & runtime
● Stateful and in-memory processing
● Multi-paradigmal: fp, data flow, type driven, oop,
declarative, prototypes, async, mp, etc.
Important decisions
● Long life Process vs Per request Process
● Stateful vs Stateless
● Asynchronous I/O vs no I/O at all
● Algorithms vs Data Structures
● Server inside App vs App inside Server
● Lazy vs Immediate
2012—2019
Step 1 (2012-2013)
● Node.js cluster mode
● Nginx as reverse proxy
● MongoDB or MySQL as DBMS
● HTTP for static files and AJAX API
● SSE for events push
Client side
Browser
Step 1 (2012-2013)
Server side
Nginx
Mongo
or My Worker Worker Worker
Web
Application
Nodejs
Master
FS
Key-
value
HTTP
SSE
Step 2 (2014-2015)
● Node.js cluster mode
● CDN for static files
● MongoDB as DBMS
● HTTP for API
● SSE for events push
Added:
MongoDB
Removed:
Nginx for static and
API proxying,
MySQL, Memcached
Client side
Browser
Step 2 (2014-2015)
Server side
Mongo
DB Worker Worker Worker
Web
Application
Nodejs
Master
Static HTTP
SSE
CDN
HTTP API
Step 3 (2016-2017)
● Node.js
● CDN for static files
● RAM for database
● Websocket
○ for API
○ for events
Added:
Websocket, In-memory
Removed:
HTTP API, SSE,
Node.js cluster mode,
MongoDB
Client side
Browser
Step 3 (2016-2017)
Server side
Persistent
Storage Worker Worker Worker
Web
Application
Nodejs
Master
Static HTTP
CDN
Websocket
Step 4 (2017) for mobile apps
● Node.js
● RAM for database
● JSTP (over TCP or WS)
○ for API
○ for events
Added:
JSTP
Removed:
Websocket,
CDN (not needed for
mobile apps)
iOS & Android
Step 4 (2017) for mobile apps
Server side
Persistent
Storage Worker Worker Worker
Mobile
Application
Nodejs
Master
JSTP (TCP)
Step 5 (2018-2019)
● Node.js
● GS for database
● Metarhia/protocol
○ for API
○ for events
○ for DB sync
○ Binary streams
Added:
GS & DB sync
Protocol
iOS & Android
Step 5 (2018-2019)
Server side
Persistent
Storage
Mobile
Application
Nodejs
Master
Sync
GS
GSGSGS
AppAppApp
JSTP
API
Features / Aspects
● Data Synchronization
● Offline
● Interactivity
● Low latency / availability
● Highload
● High connectivity
● High interconnection
● Scalability
● Big data
● Big memory &
in-memory DB
● Integration flexibility
Late period
Future alternatives
Think about...
● Linear scaling
● Client-side balancing without bottleneck
● Sharding of data and calculations
● High connectivity
● High interconnection
Bad practices checklist
● Mixing abstraction layers
● Business-logic in middlewares
● require() not at initialization
● Hells: callback, async.js, promise
● Server-side load balancing
● Dependencies and vendor lock
Usage overview in Applied fields
● Business (corporate IS including ERP, BI & BPM)
● Economics (including Supply Chain Management, CRM)
● Commerce and trading (R-T and High-Frequency Trading)
● Enterprise (Knowledge Management, CAD/CAM, DBs)
● Education (University IS, remote learning and e-Learning)
● Medicine (MDS, Diagnostics, Equipment control)
● Governance (Databases, Public services, Collaboration)
● Social networking (Instant messaging, Content publishing)
● Communications (Voice/video, IM, file exchange)
● Mass media and Highload interactive TV (second screen)
● Clusterware for massively parallel distributed cloud apps
● Production Automation, Telemetry and Internet of Things
● Fog/dew computing (use client devices for distributed data processing)
The main idea
again
Questions
Timur Shemsedinov
telegram: t.me/metarhia & t.me/nodeua
meetup.com/NodeUA
meetup.com/HowProgrammingWorks
tshemsedinov@github
tshemsedinov@facebook
marcusaurelius@habrahabr
timur.shemsedinov@gmail.com

More Related Content

What's hot

Cloud Pub_Sub
Cloud Pub_SubCloud Pub_Sub
Cloud Pub_Sub
Knoldus Inc.
 
Grafana and AWS - Implementation and Usage
Grafana and AWS - Implementation and UsageGrafana and AWS - Implementation and Usage
Grafana and AWS - Implementation and Usage
Manish Chopra
 
Kubernetes & Google Kubernetes Engine (GKE)
Kubernetes & Google Kubernetes Engine (GKE)Kubernetes & Google Kubernetes Engine (GKE)
Kubernetes & Google Kubernetes Engine (GKE)
Akash Agrawal
 
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교  및 구축 방법[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교  및 구축 방법
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
Open Source Consulting
 
Event driven autoscaling with keda
Event driven autoscaling with kedaEvent driven autoscaling with keda
Event driven autoscaling with keda
Adam Hamsik
 
공개소프트웨어 DBMS에 대한 주요 도입 및 마이그레이션 사례
공개소프트웨어 DBMS에 대한 주요 도입 및 마이그레이션 사례공개소프트웨어 DBMS에 대한 주요 도입 및 마이그레이션 사례
공개소프트웨어 DBMS에 대한 주요 도입 및 마이그레이션 사례
rockplace
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
Sangeeta Ashrit
 
Build a Voice Enabled Modern App with GraphQL, AWS AppSync, and Amazon Alexa
Build a Voice Enabled Modern App with GraphQL, AWS AppSync, and Amazon AlexaBuild a Voice Enabled Modern App with GraphQL, AWS AppSync, and Amazon Alexa
Build a Voice Enabled Modern App with GraphQL, AWS AppSync, and Amazon Alexa
Amazon Web Services
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
Bhargav Anadkat
 
KFServing - Serverless Model Inferencing
KFServing - Serverless Model InferencingKFServing - Serverless Model Inferencing
KFServing - Serverless Model Inferencing
Animesh Singh
 
Understanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsUnderstanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple Steps
Tessa Mero
 
IBM MQ - better application performance
IBM MQ - better application performanceIBM MQ - better application performance
IBM MQ - better application performance
MarkTaylorIBM
 
Consul: Service Mesh for Microservices
Consul: Service Mesh for MicroservicesConsul: Service Mesh for Microservices
Consul: Service Mesh for Microservices
ArmonDadgar
 
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
luisw19
 
KEDA Overview
KEDA OverviewKEDA Overview
KEDA Overview
Jeff Hollan
 
Journey of saga pattern in microservice architecture
Journey of saga pattern in microservice architectureJourney of saga pattern in microservice architecture
Journey of saga pattern in microservice architecture
anisurrahman403160
 
Introduction to thymeleaf
Introduction to thymeleafIntroduction to thymeleaf
Introduction to thymeleaf
NexThoughts Technologies
 
[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기
NHN FORWARD
 
An Introduction to MongoDB Ops Manager
An Introduction to MongoDB Ops ManagerAn Introduction to MongoDB Ops Manager
An Introduction to MongoDB Ops Manager
MongoDB
 
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
PgDay.Seoul
 

What's hot (20)

Cloud Pub_Sub
Cloud Pub_SubCloud Pub_Sub
Cloud Pub_Sub
 
Grafana and AWS - Implementation and Usage
Grafana and AWS - Implementation and UsageGrafana and AWS - Implementation and Usage
Grafana and AWS - Implementation and Usage
 
Kubernetes & Google Kubernetes Engine (GKE)
Kubernetes & Google Kubernetes Engine (GKE)Kubernetes & Google Kubernetes Engine (GKE)
Kubernetes & Google Kubernetes Engine (GKE)
 
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교  및 구축 방법[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교  및 구축 방법
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
 
Event driven autoscaling with keda
Event driven autoscaling with kedaEvent driven autoscaling with keda
Event driven autoscaling with keda
 
공개소프트웨어 DBMS에 대한 주요 도입 및 마이그레이션 사례
공개소프트웨어 DBMS에 대한 주요 도입 및 마이그레이션 사례공개소프트웨어 DBMS에 대한 주요 도입 및 마이그레이션 사례
공개소프트웨어 DBMS에 대한 주요 도입 및 마이그레이션 사례
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Build a Voice Enabled Modern App with GraphQL, AWS AppSync, and Amazon Alexa
Build a Voice Enabled Modern App with GraphQL, AWS AppSync, and Amazon AlexaBuild a Voice Enabled Modern App with GraphQL, AWS AppSync, and Amazon Alexa
Build a Voice Enabled Modern App with GraphQL, AWS AppSync, and Amazon Alexa
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
KFServing - Serverless Model Inferencing
KFServing - Serverless Model InferencingKFServing - Serverless Model Inferencing
KFServing - Serverless Model Inferencing
 
Understanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsUnderstanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple Steps
 
IBM MQ - better application performance
IBM MQ - better application performanceIBM MQ - better application performance
IBM MQ - better application performance
 
Consul: Service Mesh for Microservices
Consul: Service Mesh for MicroservicesConsul: Service Mesh for Microservices
Consul: Service Mesh for Microservices
 
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
 
KEDA Overview
KEDA OverviewKEDA Overview
KEDA Overview
 
Journey of saga pattern in microservice architecture
Journey of saga pattern in microservice architectureJourney of saga pattern in microservice architecture
Journey of saga pattern in microservice architecture
 
Introduction to thymeleaf
Introduction to thymeleafIntroduction to thymeleaf
Introduction to thymeleaf
 
[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기
 
An Introduction to MongoDB Ops Manager
An Introduction to MongoDB Ops ManagerAn Introduction to MongoDB Ops Manager
An Introduction to MongoDB Ops Manager
 
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
 

Similar to Node.js scaling in highload

Building RESTtful services in MEAN
Building RESTtful services in MEANBuilding RESTtful services in MEAN
Building RESTtful services in MEAN
Madhukara Phatak
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
Khaled Mosharraf
 
RedisConf17 - Dynomite - Making Non-distributed Databases Distributed
RedisConf17 - Dynomite - Making Non-distributed Databases DistributedRedisConf17 - Dynomite - Making Non-distributed Databases Distributed
RedisConf17 - Dynomite - Making Non-distributed Databases Distributed
Redis Labs
 
Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2
aspyker
 
Node.js Presentation
Node.js PresentationNode.js Presentation
Node.js Presentation
Exist
 
Dynomite @ RedisConf 2017
Dynomite @ RedisConf 2017Dynomite @ RedisConf 2017
Dynomite @ RedisConf 2017
Ioannis Papapanagiotou
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scale
Dmytro Semenov
 
Angular2 - A story from the trenches
Angular2 - A story from the trenchesAngular2 - A story from the trenches
Angular2 - A story from the trenches
Johannes Rudolph
 
Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?Dobrica Pavlinušić
 
Full stack development
Full stack developmentFull stack development
Full stack development
Pavlo Iuriichuk
 
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
Leonardo Zanivan
 
CON6423: Scalable JavaScript applications with Project Nashorn
CON6423: Scalable JavaScript applications with Project NashornCON6423: Scalable JavaScript applications with Project Nashorn
CON6423: Scalable JavaScript applications with Project Nashorn
Michel Graciano
 
AWS Lambda and Serverless framework: lessons learned while building a serverl...
AWS Lambda and Serverless framework: lessons learned while building a serverl...AWS Lambda and Serverless framework: lessons learned while building a serverl...
AWS Lambda and Serverless framework: lessons learned while building a serverl...
Luciano Mammino
 
Post-relational databases: What's wrong with web development? v3
Post-relational databases: What's wrong with web development? v3Post-relational databases: What's wrong with web development? v3
Post-relational databases: What's wrong with web development? v3
Dobrica Pavlinušić
 
Towards constrained semantic web
Towards constrained semantic webTowards constrained semantic web
Towards constrained semantic web
☕ Remy Rojas
 
Using an API Gateway for Microservices
Using an API Gateway for MicroservicesUsing an API Gateway for Microservices
Using an API Gateway for Microservices
NGINX, Inc.
 
18_Node.js.ppt
18_Node.js.ppt18_Node.js.ppt
18_Node.js.ppt
KhalilSalhi7
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
JITENDRA KUMAR PATEL
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
drupalcampest
 
AWS big-data-demystified #1.1 | Big Data Architecture Lessons Learned | English
AWS big-data-demystified #1.1  | Big Data Architecture Lessons Learned | EnglishAWS big-data-demystified #1.1  | Big Data Architecture Lessons Learned | English
AWS big-data-demystified #1.1 | Big Data Architecture Lessons Learned | English
Omid Vahdaty
 

Similar to Node.js scaling in highload (20)

Building RESTtful services in MEAN
Building RESTtful services in MEANBuilding RESTtful services in MEAN
Building RESTtful services in MEAN
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
RedisConf17 - Dynomite - Making Non-distributed Databases Distributed
RedisConf17 - Dynomite - Making Non-distributed Databases DistributedRedisConf17 - Dynomite - Making Non-distributed Databases Distributed
RedisConf17 - Dynomite - Making Non-distributed Databases Distributed
 
Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2
 
Node.js Presentation
Node.js PresentationNode.js Presentation
Node.js Presentation
 
Dynomite @ RedisConf 2017
Dynomite @ RedisConf 2017Dynomite @ RedisConf 2017
Dynomite @ RedisConf 2017
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scale
 
Angular2 - A story from the trenches
Angular2 - A story from the trenchesAngular2 - A story from the trenches
Angular2 - A story from the trenches
 
Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?
 
Full stack development
Full stack developmentFull stack development
Full stack development
 
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
 
CON6423: Scalable JavaScript applications with Project Nashorn
CON6423: Scalable JavaScript applications with Project NashornCON6423: Scalable JavaScript applications with Project Nashorn
CON6423: Scalable JavaScript applications with Project Nashorn
 
AWS Lambda and Serverless framework: lessons learned while building a serverl...
AWS Lambda and Serverless framework: lessons learned while building a serverl...AWS Lambda and Serverless framework: lessons learned while building a serverl...
AWS Lambda and Serverless framework: lessons learned while building a serverl...
 
Post-relational databases: What's wrong with web development? v3
Post-relational databases: What's wrong with web development? v3Post-relational databases: What's wrong with web development? v3
Post-relational databases: What's wrong with web development? v3
 
Towards constrained semantic web
Towards constrained semantic webTowards constrained semantic web
Towards constrained semantic web
 
Using an API Gateway for Microservices
Using an API Gateway for MicroservicesUsing an API Gateway for Microservices
Using an API Gateway for Microservices
 
18_Node.js.ppt
18_Node.js.ppt18_Node.js.ppt
18_Node.js.ppt
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
 
AWS big-data-demystified #1.1 | Big Data Architecture Lessons Learned | English
AWS big-data-demystified #1.1  | Big Data Architecture Lessons Learned | EnglishAWS big-data-demystified #1.1  | Big Data Architecture Lessons Learned | English
AWS big-data-demystified #1.1 | Big Data Architecture Lessons Learned | English
 

More from Timur Shemsedinov

How to use Chat GPT in JavaScript optimizations for Node.js
How to use Chat GPT in JavaScript optimizations for Node.jsHow to use Chat GPT in JavaScript optimizations for Node.js
How to use Chat GPT in JavaScript optimizations for Node.js
Timur Shemsedinov
 
IT Revolution in 2023-2024: AI, GPT, business transformation, future professi...
IT Revolution in 2023-2024: AI, GPT, business transformation, future professi...IT Revolution in 2023-2024: AI, GPT, business transformation, future professi...
IT Revolution in 2023-2024: AI, GPT, business transformation, future professi...
Timur Shemsedinov
 
Multithreading in Node.js and JavaScript
Multithreading in Node.js and JavaScriptMultithreading in Node.js and JavaScript
Multithreading in Node.js and JavaScript
Timur Shemsedinov
 
Node.js threads for I/O-bound tasks
Node.js threads for I/O-bound tasksNode.js threads for I/O-bound tasks
Node.js threads for I/O-bound tasks
Timur Shemsedinov
 
Node.js Меньше сложности, больше надежности Holy.js 2021
Node.js Меньше сложности, больше надежности Holy.js 2021Node.js Меньше сложности, больше надежности Holy.js 2021
Node.js Меньше сложности, больше надежности Holy.js 2021
Timur Shemsedinov
 
Rethinking low-code
Rethinking low-codeRethinking low-code
Rethinking low-code
Timur Shemsedinov
 
Hat full of developers
Hat full of developersHat full of developers
Hat full of developers
Timur Shemsedinov
 
FwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.jsFwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.js
Timur Shemsedinov
 
Node.js for enterprise - JS Conference
Node.js for enterprise - JS ConferenceNode.js for enterprise - JS Conference
Node.js for enterprise - JS Conference
Timur Shemsedinov
 
Node.js for enterprise 2021 - JavaScript Fwdays 3
Node.js for enterprise 2021 - JavaScript Fwdays 3Node.js for enterprise 2021 - JavaScript Fwdays 3
Node.js for enterprise 2021 - JavaScript Fwdays 3
Timur Shemsedinov
 
Node.js in 2021
Node.js in 2021Node.js in 2021
Node.js in 2021
Timur Shemsedinov
 
Node.js middleware: Never again!
Node.js middleware: Never again!Node.js middleware: Never again!
Node.js middleware: Never again!
Timur Shemsedinov
 
Patterns and antipatterns
Patterns and antipatternsPatterns and antipatterns
Patterns and antipatterns
Timur Shemsedinov
 
Race-conditions-web-locks-and-shared-memory
Race-conditions-web-locks-and-shared-memoryRace-conditions-web-locks-and-shared-memory
Race-conditions-web-locks-and-shared-memory
Timur Shemsedinov
 
Asynchronous programming and mutlithreading
Asynchronous programming and mutlithreadingAsynchronous programming and mutlithreading
Asynchronous programming and mutlithreading
Timur Shemsedinov
 
Node.js in 2020 - part 3
Node.js in 2020 - part 3Node.js in 2020 - part 3
Node.js in 2020 - part 3
Timur Shemsedinov
 
Node.js in 2020 - part 2
Node.js in 2020 - part 2Node.js in 2020 - part 2
Node.js in 2020 - part 2
Timur Shemsedinov
 
Information system structure and architecture
Information system structure and architectureInformation system structure and architecture
Information system structure and architecture
Timur Shemsedinov
 
Node.js in 2020 - part 1
Node.js in 2020 - part 1Node.js in 2020 - part 1
Node.js in 2020 - part 1
Timur Shemsedinov
 
Web Locks API
Web Locks APIWeb Locks API
Web Locks API
Timur Shemsedinov
 

More from Timur Shemsedinov (20)

How to use Chat GPT in JavaScript optimizations for Node.js
How to use Chat GPT in JavaScript optimizations for Node.jsHow to use Chat GPT in JavaScript optimizations for Node.js
How to use Chat GPT in JavaScript optimizations for Node.js
 
IT Revolution in 2023-2024: AI, GPT, business transformation, future professi...
IT Revolution in 2023-2024: AI, GPT, business transformation, future professi...IT Revolution in 2023-2024: AI, GPT, business transformation, future professi...
IT Revolution in 2023-2024: AI, GPT, business transformation, future professi...
 
Multithreading in Node.js and JavaScript
Multithreading in Node.js and JavaScriptMultithreading in Node.js and JavaScript
Multithreading in Node.js and JavaScript
 
Node.js threads for I/O-bound tasks
Node.js threads for I/O-bound tasksNode.js threads for I/O-bound tasks
Node.js threads for I/O-bound tasks
 
Node.js Меньше сложности, больше надежности Holy.js 2021
Node.js Меньше сложности, больше надежности Holy.js 2021Node.js Меньше сложности, больше надежности Holy.js 2021
Node.js Меньше сложности, больше надежности Holy.js 2021
 
Rethinking low-code
Rethinking low-codeRethinking low-code
Rethinking low-code
 
Hat full of developers
Hat full of developersHat full of developers
Hat full of developers
 
FwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.jsFwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.js
 
Node.js for enterprise - JS Conference
Node.js for enterprise - JS ConferenceNode.js for enterprise - JS Conference
Node.js for enterprise - JS Conference
 
Node.js for enterprise 2021 - JavaScript Fwdays 3
Node.js for enterprise 2021 - JavaScript Fwdays 3Node.js for enterprise 2021 - JavaScript Fwdays 3
Node.js for enterprise 2021 - JavaScript Fwdays 3
 
Node.js in 2021
Node.js in 2021Node.js in 2021
Node.js in 2021
 
Node.js middleware: Never again!
Node.js middleware: Never again!Node.js middleware: Never again!
Node.js middleware: Never again!
 
Patterns and antipatterns
Patterns and antipatternsPatterns and antipatterns
Patterns and antipatterns
 
Race-conditions-web-locks-and-shared-memory
Race-conditions-web-locks-and-shared-memoryRace-conditions-web-locks-and-shared-memory
Race-conditions-web-locks-and-shared-memory
 
Asynchronous programming and mutlithreading
Asynchronous programming and mutlithreadingAsynchronous programming and mutlithreading
Asynchronous programming and mutlithreading
 
Node.js in 2020 - part 3
Node.js in 2020 - part 3Node.js in 2020 - part 3
Node.js in 2020 - part 3
 
Node.js in 2020 - part 2
Node.js in 2020 - part 2Node.js in 2020 - part 2
Node.js in 2020 - part 2
 
Information system structure and architecture
Information system structure and architectureInformation system structure and architecture
Information system structure and architecture
 
Node.js in 2020 - part 1
Node.js in 2020 - part 1Node.js in 2020 - part 1
Node.js in 2020 - part 1
 
Web Locks API
Web Locks APIWeb Locks API
Web Locks API
 

Recently uploaded

Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 

Recently uploaded (20)

Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 

Node.js scaling in highload

  • 1. Node.js Scaling in Highload Timur Shemsedinov KPI, Metarhia
  • 2. You will rewrite all your code to reach each level ● 100 connections anyhow ● <50k connections single process ● ~500k connections single server ● >1 mln. connections single with opt. or cloud ● >2,5 mln. connections multiple servers ● >10 mln. connections clusterware or cloud
  • 3. Scaling and performance factors: ● JavaScript, V8 ● Node.js, libuv ● Code style and patterns ● Architectural decisions ● Dependencies
  • 4.
  • 5. JavaScript is... ● Implemented and available everywhere ● Most common and widespread language ● Minimalistic syntax ● Libraries, community: NPM, Github and Stackoverflow ● Patterns: streams, factories, observers, queues, etc. ● Techniques: lambdas, closures, mixins, chaining, functors...
  • 6. JavaScript is... ● Unpredictable optimizations in V8 ● Async, blocking, long loops & recursion ● The Tower of Babel ● Crap in NPM & idiots in community ● Multiparadigm approach isn’t so easy ● Problems: mixins, poor types, change built-in classes...
  • 7. Node.js is... ● Asynchronous I/O, libuv, streams ● V8, stat optimization, hidden classes... ● Production ready infrastructure & runtime ● Stateful and in-memory processing ● Multi-paradigmal: fp, data flow, type driven, oop, declarative, prototypes, async, mp, etc.
  • 8. Important decisions ● Long life Process vs Per request Process ● Stateful vs Stateless ● Asynchronous I/O vs no I/O at all ● Algorithms vs Data Structures ● Server inside App vs App inside Server ● Lazy vs Immediate
  • 10. Step 1 (2012-2013) ● Node.js cluster mode ● Nginx as reverse proxy ● MongoDB or MySQL as DBMS ● HTTP for static files and AJAX API ● SSE for events push
  • 11. Client side Browser Step 1 (2012-2013) Server side Nginx Mongo or My Worker Worker Worker Web Application Nodejs Master FS Key- value HTTP SSE
  • 12. Step 2 (2014-2015) ● Node.js cluster mode ● CDN for static files ● MongoDB as DBMS ● HTTP for API ● SSE for events push Added: MongoDB Removed: Nginx for static and API proxying, MySQL, Memcached
  • 13. Client side Browser Step 2 (2014-2015) Server side Mongo DB Worker Worker Worker Web Application Nodejs Master Static HTTP SSE CDN HTTP API
  • 14. Step 3 (2016-2017) ● Node.js ● CDN for static files ● RAM for database ● Websocket ○ for API ○ for events Added: Websocket, In-memory Removed: HTTP API, SSE, Node.js cluster mode, MongoDB
  • 15. Client side Browser Step 3 (2016-2017) Server side Persistent Storage Worker Worker Worker Web Application Nodejs Master Static HTTP CDN Websocket
  • 16. Step 4 (2017) for mobile apps ● Node.js ● RAM for database ● JSTP (over TCP or WS) ○ for API ○ for events Added: JSTP Removed: Websocket, CDN (not needed for mobile apps)
  • 17. iOS & Android Step 4 (2017) for mobile apps Server side Persistent Storage Worker Worker Worker Mobile Application Nodejs Master JSTP (TCP)
  • 18. Step 5 (2018-2019) ● Node.js ● GS for database ● Metarhia/protocol ○ for API ○ for events ○ for DB sync ○ Binary streams Added: GS & DB sync Protocol
  • 19. iOS & Android Step 5 (2018-2019) Server side Persistent Storage Mobile Application Nodejs Master Sync GS GSGSGS AppAppApp JSTP API
  • 20. Features / Aspects ● Data Synchronization ● Offline ● Interactivity ● Low latency / availability ● Highload ● High connectivity ● High interconnection ● Scalability ● Big data ● Big memory & in-memory DB ● Integration flexibility
  • 23. Think about... ● Linear scaling ● Client-side balancing without bottleneck ● Sharding of data and calculations ● High connectivity ● High interconnection
  • 24. Bad practices checklist ● Mixing abstraction layers ● Business-logic in middlewares ● require() not at initialization ● Hells: callback, async.js, promise ● Server-side load balancing ● Dependencies and vendor lock
  • 25.
  • 26. Usage overview in Applied fields ● Business (corporate IS including ERP, BI & BPM) ● Economics (including Supply Chain Management, CRM) ● Commerce and trading (R-T and High-Frequency Trading) ● Enterprise (Knowledge Management, CAD/CAM, DBs) ● Education (University IS, remote learning and e-Learning) ● Medicine (MDS, Diagnostics, Equipment control)
  • 27. ● Governance (Databases, Public services, Collaboration) ● Social networking (Instant messaging, Content publishing) ● Communications (Voice/video, IM, file exchange) ● Mass media and Highload interactive TV (second screen) ● Clusterware for massively parallel distributed cloud apps ● Production Automation, Telemetry and Internet of Things ● Fog/dew computing (use client devices for distributed data processing)
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 37. Timur Shemsedinov telegram: t.me/metarhia & t.me/nodeua meetup.com/NodeUA meetup.com/HowProgrammingWorks tshemsedinov@github tshemsedinov@facebook marcusaurelius@habrahabr timur.shemsedinov@gmail.com