18
Software System Architecture for Node.js Timur Shemsedinov Research Institute of System Technologies

Node.js architecture (EN)

Embed Size (px)

Citation preview

Page 1: Node.js architecture (EN)

SoftwareSystemArchitecturefor Node.jsTimur ShemsedinovResearch Institute of System Technologies

Page 2: Node.js architecture (EN)

Local applications and console utilities• Task runers and build systems• Scripting, CLI, testing, documentation generation

Servers• API and backends for SPA (AJAX/JSON, RPC, REST)• Event delivery (for chats, games & interactive apps)• Covering gaps in other applications

Clients• Crawlers, data mining, testing scripts• GUI applications (nw.js, node-webkit)

Hardware• Control systems and production automation

#1 Classification of Node.js use

Page 3: Node.js architecture (EN)

#2 Where Architecture begins?

Complexity• The system doesn't fit in the head• Long development• Large teams

• Reuse abstract codeReliability• Confidence for owners• Load scalability• Team scalability

Variability• Live systems are changes constantly

Page 4: Node.js architecture (EN)

#3 Node.js and Architecture

JavaScript

node.js

io.js

Frontend developers hordes encroach invades server-side

S

B

Arch

itect

ors

Conceptualists

Corporate

Bullshit

Page 5: Node.js architecture (EN)

JavaScript

node.js

io.js

Choosing the right allies

S

B

Arch

itect

ors

Conceptualists

Corporate

Bullshit

#3 Node.js and Architecture

Page 6: Node.js architecture (EN)

#4 Node.js Architectural Problems

Old-style thinking inherited from:• Languages and servers of short process life• Frontend (web and window GUI)• Heavy legacy of OOP

Abstraction Problems• The applied and system code is mixed• Abstract layers principle ис not satisfied

(from lower to higher layer)• Inconsistency (different levels of abstraction are

mixed in a single layer)• Attempts to separate logic and data

(impossible in Von Neumann architecture)

Page 7: Node.js architecture (EN)

#5 Misconceptions about Node.js

Common architectural principlesA common architectural practices for Node.jshas not formed yet but (the worst) it is believed that they have already formed

It seems that all out of the box......but pure node.js is very low-level tool

A set of incompatible:technologies, ideas, principles and conceptsin one application

NIH (not invented here)Good and bad aspects of NIH

Page 8: Node.js architecture (EN)

#6 What is not Architecture?• Middleware• Routers• Single entry point...• Facade, singleton• Mixin, closure• Factory, decorator• Class and object• Prototype, DI etc.• MVC, MVP, MVVM• ORM, CRUD, Key-value• Pull/Push, Pub/Sub• REST, RPC и т. д.• Clouds, SaaS, PaaS...

Code structure patterns}OOP patterns}GUI and DB patterns}

Communication patterns}Deployment patterns}

Page 9: Node.js architecture (EN)

#7 What is Architecture?

• Division• naming• and binding

Page 10: Node.js architecture (EN)

#8 What is Architecture?

Architectural task• Divide and give names, build connections• Combine subsystems to system

Concepts and Tools Selection• Paradigms, standards, models• Technologies, frameworks, patterns

• Module interaction types• Topology• Protocols and data formats

System Integration• Planning internal interfaces before development • Define external interfaces and links

Page 11: Node.js architecture (EN)

Asynchrony• Lazy operations• Maximizing memory usage• No I/O is faster even then asyncronous I/O

State (statefull vs stateless)• Long-living processes can afford this...• Stateless gives nothing nowadays• Application can't contain just pure functions• Interactivity or large state requires stateful

Scalability• IP and cookie sticky• Interprocess communication

#9 Node.js Features

Page 12: Node.js architecture (EN)

#10 Minimal client-server A.

Client

Server

DBMS

interface

process

request

response

Client

Server

DBMS

browser

Page 13: Node.js architecture (EN)

#11 Separation and Binding

Client

Server

DBMS

browser

Client

Server

DBMS

browser

stubs and marshalling

binding

e.g. ORM

e.g. RPC

Page 14: Node.js architecture (EN)

#12 Introspection and Binding

Dynamic binding

Page 15: Node.js architecture (EN)

#13 Wrong Layer Separation

Client

Server

DBMS

Interface

Logic

Data

Logi

c

Dat

a

Int e

rfac

e

Page 16: Node.js architecture (EN)

#14 Right Layer Separation

Client

Server

DBMS

Interface

DataLogic

Interface

DataLogic

Interface

DataLogic

Page 17: Node.js architecture (EN)

You can't opose them:«The system distributed betteris the better centralized one»

Monolithic is not bad, bad is when we have strong coupling between modules and loose coupling inside module.

General rules, restrictions, agreements and standards make microservices one monolithic but the lack of consistency leads to the fact that the system is not a system at all, it falls into parts, it is not stable, not operating acording to one goal as an organisms should do.

#15 Microservices vs Monolithic

Page 18: Node.js architecture (EN)

Software SystemArchitecturefor Node.js

Timur ShemsedinovResearch Institute of System Technologies

Thank youYour questions please