LW 4.1
Written by jh
About version
■ Why v4.1?
■ Where are v1,2,3,4
Beta
10.2015
OS : window
Server : IIS
Server script : php
DB : mysql
Raw : file
CSS : none
Beta
summary수신가능
1
데이터
유효성 판단
2
맵 트래킹
가능
3
無 to the 有
1.0
11.2015
OS : window
Server : IIS
Server script : php
DB : mysql
Raw : file
CSS : wordpress, jqueryUI
1.0 summary
■ http://xxx.com/en
■ Designer의 부재를 wordpress(blog 생성툴)로 대체
■ Ajax의 도입: Realtime page refresh
2.0
3.2016
OS : window
Server : IIS
Server script : php
DB : mysql
Raw : file
CSS : bootstrap
2.0 summary
■ http://xxx.com/bt
■ Css : bootstrap
■ Improved js,php 50%
2.1
5.2016
OS : Linux
Server : nodejs
Server script : nodejs
DB : mongodb
Raw : mongodb
CSS : bootstrap
Git : lfms
2.1 summary
■ Linux
■ Nodejs
■ mongodb
■ Geofence
■ git
■ Bootstrap 80%
3.0
5.2016
OS : Linux
Server : nodejs
Server script : nodejs
DB : mongoDB
Raw : mongoDB
CSS : bootstrap admin
Git : lfms
3.0 summary
■ Admin panel
■ Android X
■ Linux X
■ noSQL X
■ Nodejs X
3.1
12.2016
OS : Linux
Server : nodejs
Server script : nodejs
DB : mariaDB
Raw : mariaDB
CSS : bootstrap admin
Git : hyiv
3.1 summary
■ Embedded linux
■ Node’s other communications
■ mariaDB
4.0
11.2016
OS : Linux
Server : nodejs
Server script : nodejs
DB : mongoDB
Raw : mongoDB
CSS : bootstrap admin smart
Git : lw
Native App to Web App
4.0 summary
■ To web
■ Security up : ssl(https)
■ Admin template
4.1
2.2017
OS : Linux
Server : nodejs
Server script : nodejs
DB : mongoDB
Raw : mongoDB
CSS : bootstrap admin smart
Git : lw
Service ready
Device
User
User
User
Device
Device
Web
Comm
Calc
DB
Structure under 100
Server platformVS
Scale-up
■ 초기 설계시 커넥션 계산
■ 연속성 X
■ simple
Scale-out
■ 추후 확장,소거
■ 연속성 O
■ complex
Device
User LB
LB
Web
Comm
User
User
Device
Device
Comm
Comm
Web
Web
Device :Tracker&mobile
User : Browser,app
LB : Load Balancer
Comm : Recieve Server
Web :Web Server
DB : Database
: 차후확장
Structure over 1000
Calc
Calc
DB
DB
DB
DB
Load balancer
round-robin
Device LB Comm
Device
Device
Comm
Comm
11
2 2
3
3
3
Database sharding
3331000 rows Add shard
333
334
2501000 rows
250
250
250
Calc server?
■ Over speed
■ Geofence
■ Etc..
Calc data
Recieve
■ From last data
Re-calc
■ 기준값 변경
– Over-speed, Geo-fence, etc..
DB schema
devices
DB schema
devices._info
DB schema
days
DB schema
days._summ
DB schema
raws
Receive process
Device
parserTCP Binary OK
error
Response
Empty
Devices find Mode:data
Mode:ota
Days find
Devices create
Empty
Days update Raws find
Days create Empty Raws insert
Ota fileread Ota send
Data import
by import.js
Before.com
■ MariaDB
■ files
Current.com
■ mongoDB
Data import
result
■ Devices : 333
■ Days : 44,749
■ Raws : 125,948,429
■ time: 13:12:00
4.1 summary
■ Database sharding
■ Load balancer
■ Raw summary > calc
Web service
■ Front-end
– Jquery, vue.js, angular.js, react.js > DOMChanger
– Css, html
– Pug
■ Back-end
– node.js+express, ruby on rails, python+django/flask, java+spring
– Database
■ noSQL : mongoDB, RDBMS : mariaDB,oracle,…
Web service structure
Back-end
Front-end
Request :
xhr
DB
Request
Response :
html file
Request :
CRUD
Response :
json
Response :
pretty json
Script
Front-end
■ Test.html
-----
<h3>Hello? My name is : <span id=“a”>??</span></h3>
<script>
$(function(){
let url = ‘https://xxx.com/api/user/name
$(.get).function(url,r) {
//r = ‘철수’
$(‘#id’).html(r); //DOM Change
}
})
</script>
-----
■ Output
Hello? My name is : 철수
Responsive site
■ 반응형
■ 해상도 별 contents-view 다름 ( xs, sm, md, lg)
– 모바일을 위해 버튼등은 커지고 있는 추세
■ 모바일 페이지를 따로 만드는 경우 : m.naver.com X
– 요청헤더의 타입(모바일,데스크탑)으로 도메인 판단하여 전송
X
X
O
O
Google analytics
■ Traffic
■ Page view
■ region
Google api admin
■ Map use
■ Free : 25,000 request per day
■ Max : 100,000 request per day
RESTfulAPI
CRUD
Name Description Database HTTP
Create 생성 INSERT POST
Read(또는 Retrieve) 읽기(또는 인출) SELECT GET
Update 갱신 UPDATE PUT
Delete(또는 Destroy) 삭제(또는 파괴) DELETE DELETE
Server code is…
■ Always! Multi
*stand alone
For(i = 0; i < 10; i++) {
If(fs= fileopen(String(i)+‘.txt’)) {
show(‘i’);// 0,1,2,3,..9
//processing
//blocking but ok
fileclose(fs);
}
}
*blocking server
For(i = 0; i < 10; i++) {
If(fs = fileopen(String(i)+‘.txt’)) {
show(i); //0,1,2,3,…9
//processing
//blocking but error
//task is newThread();
fileclose(fs)
}
}
*non-blocking server
For(i = 0; i < 10; i++) {
fs.fileopen(String(i)+‘.txt’,func {
show(i); //7,9,2,5,…?
//processing
//non-blocking but too many..
//next with callback
//need queue…
fileclose()//error
})
}
Callback hell
db.find(‘localhost’,function(err,d) {
if(err) return console.error(err);
fs.fileopen(d.fname, funciton(err,f) {
if(err) return console.error(err);
let a = f[0] + f[1];
db.update({_id:’a’},{$set:{_val:a}},function(err,u) {
if(err) return console.error(err);
req.session.destroy(function(err) {
console.log(’success’);
db.close();
});
});
});
});
Callback hell break => Class
Maintenance
■ CloudVM : OS
– NetworkTraffic
– VM health status
■ Database
– Shards health status
– backup
■ Security
■ Disk
■ Domain
CloudVM
■ Scale-out
– VM 복제 Load-balancer setting
■ PM2 monitor
– CPU, Mem, error 등 상태 파악
Security
■ Injection
■ Brute Force
■ Ddos
■ firewall
Security
firewall miss
Security
injection
Maintenance
■ end is not end
2years touch
true
■ Slow development
■ Platform dev stop
■ With plan
false
■ Fast development
■ New platform launch
■ Without plan = hell

Lw 4.1