Authored by 毕凯

Merge remote-tracking branch 'origin/feature/qps' into gray

... ... @@ -71,9 +71,9 @@ app.set('json replacer', function(key, value) {
});
// 请求限制中间件
if (!app.locals.devEnv) {
app.use(require('./doraemon/middleware/limiter'));
}
//if (!app.locals.devEnv) {
// app.use(require('./doraemon/middleware/limiter'));
//}
// 指定libray目录
global.utils = path.resolve('./utils');
... ...
... ... @@ -7,6 +7,8 @@ const _getProductBySkns = function(productObj) {
return api.get('', {
productSkn: productObj.defaultSkns,
method: 'h5.product.batch'
}, {
cache: true
}).then((result) => {
productObj.defaultPros = [];
if (result && result.data && result.data.product_list && result.code === 200) {
... ...
... ... @@ -68,6 +68,11 @@ exports.preference = (req, res, next) => {
yhChannel: req.query.yhChannel,
limit: '20' // 后期值需要修改的话得手动改
}).then((result) => {
res.set({
'Cache-Control': 'max-age=' + 300 // 此接口不走render,手动缓存5分钟
});
res.removeHeader('Pragma');
res.removeHeader('Expires');
res.send(result);
}).catch(next);
};
... ...
... ... @@ -17,7 +17,10 @@ const cachePage = {
'/channel/:id.html': 1 * MINUTE,
// ajax获取频道页楼层
'/channel/getResourceContent': 30 * MINUTE,
'/channel/getResourceContent': 30 * SECOND,
// 活动模板
'/activity/feature/:code.html': 1 * MINUTE,
// 商品分类
'/cate': 5 * MINUTE,
... ... @@ -25,6 +28,7 @@ const cachePage = {
// 商品详情页
'/product/\\/pro_([\\d]+)_([\\d]+)\\/(.*)/': 30 * MINUTE,
'/product/\\/show_([\\d]+)/': 30 * MINUTE,
'/product/^\\/(\\d+)\\.html/': 30 * MINUTE,
// 商品详情ajax
... ... @@ -38,6 +42,8 @@ const cachePage = {
// 店铺简介
'/product/index/intro': 15 * MINUTE,
'/product/newsale/hotrank': 1 * MINUTE,
// 逛
'/guang/': 1 * MINUTE,
'/guang/info/index': 10 * MINUTE,
... ... @@ -49,6 +55,9 @@ const cachePage = {
'/guang/plusstar/resources-goodsList': 1 * MINUTE,
'/guang/index/page': 1 * MINUTE,
'/guang/^\\/info\\/(.*?)\\.html/': 1 * MINUTE,
'/guang/info/getComments': 1 * MINUTE,
// '/guang/plustar/brandinfo': 1 * MINUTE,
'/guang/star': 1 * MINUTE,
... ... @@ -83,6 +92,8 @@ const cachePage = {
'/product/sale/breakingYards': 5 * MINUTE,
'/product/sale/discount/detail': 5 * MINUTE,
'/product/sale/search': 5 * MINUTE,
// 奥莱
'/product/outlet': 30 * SECOND,
'/product/outlet/activity': 1 * MINUTE,
... ... @@ -91,6 +102,8 @@ const cachePage = {
// 品牌一览
'/brands': 5 * MINUTE,
'/brands/search': 1 * MINUTE,
'/^\\/(.*?)-brands/': 1 * MINUTE,
'/brands/getBrandList': 1 * MINUTE,
// 直播活动
'/activity/live': 1 * MINUTE,
... ...
... ... @@ -73,7 +73,7 @@ module.exports = {
maxFiles: 7
},
console: {
level: 'info',
level: 'error',
colorize: 'all',
prettyPrint: true
}
... ... @@ -111,7 +111,7 @@ module.exports = {
jsSdk: '//cdn.yoho.cn/js-sdk/1.2.4/jssdk.js',
redis: {
connect: {
host: '127.0.0.1',
host: '192.168.104.32',
port: '6379',
retry_strategy(options) {
if (options.error && options.error.code === 'ECONNREFUSED') {
... ... @@ -148,8 +148,18 @@ if (isProduction) {
family: 'http://uic.yoho.cn/uic/'
},
memcache: {
master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
session: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
master: [
'memcache1.yohoops.org:12111',
'memcache2.yohoops.org:12111',
'memcache3.yohoops.org:12111',
'memcache4.yohoops.org:12111'
],
session: [
'memcache1.yohoops.org:12111',
'memcache2.yohoops.org:12111',
'memcache3.yohoops.org:12111',
'memcache4.yohoops.org:12111'
],
poolSize: 100,
reconnect: 5000,
timeout: 1000,
... ... @@ -224,8 +234,8 @@ if (isProduction) {
family: 'http://192.168.103.73:8096/uic/'
},
memcache: {
master: ['127.0.0.1:12111'],
session: ['127.0.0.1:12111'],
master: ['192.168.104.15:12111', '192.168.104.29:12111', '192.168.104.32:12111'],
session: ['192.168.104.15:12111', '192.168.104.29:12111', '192.168.104.32:12111'],
timeout: 100,
reconnect: 5000,
retries: 0
... ...
... ... @@ -73,7 +73,7 @@
"xml2js": "^0.4.19",
"yoho-express-session": "^2.0.0",
"yoho-md5": "^2.0.0",
"yoho-node-lib": "=0.5.10",
"yoho-node-lib": "=0.5.11",
"yoho-zookeeper": "^1.0.8"
},
"devDependencies": {
... ...
... ... @@ -3,7 +3,7 @@
{
"name": "yohobuywap-node",
"script": "app.js",
"instances": "3",
"instances": "8",
"exec_mode": "cluster",
"merge_logs": true,
"log_date_format": "YYYY-MM-DD HH:mm:ss Z",
... ...