Create a cluster on GKE:
gcloud container clusters create backend --num-nodes=2 --machine-type n1-standard-4
Get credentials:
gcloud container clusters get-credentials backend
Build the docker image:
| Node Garbage Collector | |
| How GC works | |
| 1) https://strongloop.com/strongblog/node-js-performance-garbage-collection/ | |
| 2) https://strongloop.com/strongblog/node-js-performance-heap-profiling-tip/ | |
| 3) http://jayconrod.com/posts/55/a-tour-of-v8-garbage-collection | |
| How to find Memory leaks and probable cause | |
| https://hacks.mozilla.org/2012/11/tracking-down-memory-leaks-in-node-js-a-node-js-holiday-season/ |
Create a cluster on GKE:
gcloud container clusters create backend --num-nodes=2 --machine-type n1-standard-4
Get credentials:
gcloud container clusters get-credentials backend
Build the docker image:
| --log_gc (Log heap samples on garbage collection for the hp2ps tool.) | |
| type: bool default: false | |
| --expose_gc (expose gc extension) | |
| type: bool default: false | |
| --max_new_space_size (max size of the new generation (in kBytes)) | |
| type: int default: 0 | |
| --max_old_space_size (max size of the old generation (in Mbytes)) | |
| type: int default: 0 | |
| --max_executable_size (max size of executable memory (in Mbytes)) | |
| type: int default: 0 |
| # Redis Cheatsheet | |
| # All the commands you need to know | |
| redis-server /path/redis.conf # start redis with the related configuration file | |
| redis-cli # opens a redis prompt | |
| # Strings. |
| const mongoose = require('mongoose'); | |
| const bluebird = require('bluebird'); | |
| const User = require('./model'); | |
| mongoose.Promise = bluebird; | |
| constructPopulateConfigObj = (level, path) => { | |
| const oneLevel = () => ({ path }); | |
| let obj = oneLevel(); |
| function (str) { | |
| str = str.toLowerCase(); | |
| str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, 'a'); | |
| str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, 'e'); | |
| str = str.replace(/ì|í|ị|ỉ|ĩ/g, 'i'); | |
| str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, 'o'); | |
| str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g, 'u'); | |
| str = str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g, 'y'); | |
| str = str.replace(/đ/g, 'd'); | |
| // str = str.replace(/\W+/g, ' '); |