Backend
-
How to configure gzip on Nginx?Backend 2019. 12. 18. 17:39
Nginx에서 Gzip 압축 설정을 할 수 있다. Gzip 설정을 On 하게 되면 보내야 하는 데이터의 용량을 줄여서 보내게 된다. 그 말은 브라우저에서 받은 파일을 압축해제 해야 한다는 것이다. Gzip OFF : 서버 반응 속도 상승 / 데이터 다운 시간 상승 Gzip ON : 서버 반응 속도 하강 / 데이터 다운 시간 절약 그 결과는 아래에서 확인 할 수 있다. 아래 결과를 비교해보자. 테스트한 사이트에서는 평균적으로 요청에 걸리는 총 시간은 비슷한걸 확인했다. 차이점은 'Waiting' 시간과 'Content Download' 시간의 비율이다. 압축을 할 경우 용량이 줄어들어 확실히 다운로드 시간은 절약이된다.(트래픽 비용 절약, 모바일 배려) 하지만 브라우저에서 압축을 해제 하는 과정이 추가되어..
-
How to configure nginx as reverse proxy for node.js(express) with aws ec2.Backend 2019. 12. 18. 16:31
node.js express memory optimization 관련해서 정보를 찾던 중 reverse proxy 레벨에서 압축(gzip)을 사용하면 도움이 된다는 사실을 알게 되었다. 그래서 내 프로젝트에 nginx로 reverse proxy를 구현하고자 한다. express 서버는 3000포트를 사용한다. nginx에서 8000포트로 들어오는 요청을 127.0.0.1:3000로 포워드한다. 대략 아래와 같은 구조로 만들려고 한다. 이렇게하면 요청이 Nginx를 거쳐서 접근이 되기 때문에 내부 서버의 포트를 외부로부터 숨길 수 있다. (이 글에선 node express 서버 구축과 aws 인프라 설정은 생략하겠다.) 먼저 nginx conf 파일을 아래와 같이 생성하자. $ nano /etc/nginx..
-
[node] express compression 메모리 최적화 (memory optimization)Backend/NodeJS 2019. 12. 18. 11:57
현재 내 express 서버의 메모리 용량이다. 메모리를 한번 줄여보고자 한다. node.js express에서 가장 흔히 쓰는 방법이 expression 이다. 간단하게 gzip을 적용한다 생각하면 된다. expression 설치는 아래 링크에서 확인! compression github 소스에 적용시키고 // index.js import compression from "compression"; import express from "express"; ...... app.use(compression()); ..... 빌드 후 실행을 시켰더니 조금 떨어지는듯 했다. 몇시간 지나니 다시 비슷해졌다.. 이 글을 쓰는 와중에 더 올라갔다.. ※참고로 서버 요청은 하나도 없었다. 그리고 하루를 더 보냈다. serv..
-
[node] How to send remind-push to customersBackend/NodeJS 2019. 11. 27. 17:21
What is the remind-push? It is push notifications that leads users to access PLANT app service. So, We expect more connection & active users. When should I send it? 하루 중, 자주 접속 했던 시간이 지났는 데도 접속을 하지 않았을때 During a day, When they didn't connect until the time they frequently connect. How? I use data selectivity, histogram. 작업 프로세스 Step 1. 사용자들의 활동에 대한 날짜를 수집한다. Get timestamp that user activity. 2. ..
-
[node] How to double co-routine in promise & loopBackend/NodeJS 2019. 11. 26. 17:06
비동기 작업의 동기화, 코루틴 각 회원들의 프로필과 친구리스트를 회원별로 새로운 객체에 담고 싶을때 co-routine과 promise를 활용하여 DB 작업은 비동기로 처리하고 베이스 루틴은 동기적으로 처리하여 만들어진 객체를 반환한다. 이 작업은 코루틴 안에서 작업을 비동기적으로 하면서, 모든 작업이 완료되었을 때 반환한다. When all jobs are done, this funtion is return and the main tasks are processed asyncronously. const cofunc = bPromise.coroutine(function* () { try { ... const members = yield getMembers();// get DB // [{"id":"", "..
-
[django] channels 설치시 에러Backend/django 2019. 10. 29. 16:14
$ pip install channels 에러 내용: ... /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:214:2: error: unknown type name 'uint64_t' uint64_t ri_interrupt_wkups; ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. error: command 'gcc' failed with exit status 1 ---------------------------..
-
Node.js 성능 향상 팁optimization Tip with clinicBackend/NodeJS 2019. 8. 5. 10:53
https://www.tutorialdocs.com/article/nodejs-performance.html 8 Tips For Node.js Performance Optimization - TutorialDocs 1. Update To The Latest Version of Node.js You can improve the performance easily by upgrading the Node.js version simply, because almost any newer version for Node.js will be better than the older version. The performance improvement of each version for N www.tutorialdocs.com ..