用Koa中间层,作为站点的前后端分离方案。在测试机上跑起来都很正常。 但是到公司的Beta服务器上,发现会经常性的出现响应慢的问题。 但是从node写的日志文件发现,前端渲染和接口转发时间都很短,也没有捕获到错误日志。 看beta服务器的性能,1G内存才跑(40%),cpu也才非常低。 所以怀疑是不是Ngnix反向代理也需要配置最大链接数呢? 下面是页面渲染时间 和 接口相应时间的日志。 麻烦有相关经验的,帮忙分析一下。看日志接口时间和模板渲染时间都比较正常,所以比较懵! ==================== 模板渲染时间 ================ [2018-08-31T18:14:35.375] [TRACE] templateFile - 129ms: index.html [2018-08-31T18:14:39.959] [TRACE] templateFile - 552ms: index.html [2018-08-31T18:16:08.142] [TRACE] templateFile - 193ms: detail.html [2018-08-31T18:16:16.518] [TRACE] templateFile - 87ms: buy/checkout.html [2018-08-31T18:16:19.379] [TRACE] templateFile - 53ms: buy/payment.html [2018-08-31T18:17:06.490] [TRACE] templateFile - 183ms: index.html [2018-08-31T18:17:11.651] [TRACE] templateFile - 170ms: index.html [2018-08-31T18:17:12.944] [TRACE] templateFile - 110ms: detail.html [2018-08-31T18:17:14.953] [TRACE] templateFile - 85ms: buy/checkout.html [2018-08-31T18:17:17.254] [TRACE] templateFile - 208ms: buy/payment.html [2018-08-31T18:20:57.980] [TRACE] templateFile - 261ms: index.html [2018-08-31T18:21:16.759] [TRACE] templateFile - 171ms: list.html [2018-08-31T18:21:19.340] [TRACE] templateFile - 143ms: cart.html [2018-08-31T18:21:21.449] [TRACE] templateFile - 60ms: personal.html [2018-08-31T18:21:28.152] [TRACE] templateFile - 845ms: index.html [2018-08-31T18:21:29.853] [TRACE] templateFile - 412ms: index.html [2018-08-31T18:21:32.637] [TRACE] templateFile - 34ms: personal.html [2018-08-31T18:21:39.674] [TRACE] templateFile - 32ms: list.html
=============后端接口相应时间===================== [2018-08-31T18:04:48.525] [TRACE] dateFile - 10ms: cart/cart/delete_checkout.json [2018-08-31T18:04:48.582] [TRACE] dateFile - 34ms: trade/trade/payment.json [2018-08-31T18:04:51.277] [TRACE] dateFile - 404ms: trade/payment/wxpay_wap.json [2018-08-31T18:05:06.451] [TRACE] dateFile - 296ms: block/block/item_list.json [2018-08-31T18:12:49.071] [TRACE] dateFile - 585ms: block/block/item_list.json [2018-08-31T18:14:32.664] [TRACE] dateFile - 167ms: block/block/item_list.json [2018-08-31T18:14:35.374] [TRACE] dateFile - 127ms: block/block/item_list.json [2018-08-31T18:14:39.959] [TRACE] dateFile - 551ms: block/block/item_list.json [2018-08-31T18:15:45.583] [TRACE] dateFile - 77ms: cart/cart/get_list.json [2018-08-31T18:15:45.609] [TRACE] dateFile - 58ms: product/product/evaluation_list [2018-08-31T18:15:45.665] [TRACE] dateFile - 105ms: promotion/coupon/get_list [2018-08-31T18:15:46.969] [TRACE] dateFile - 83ms: cart/cart/checkout.json [2018-08-31T18:16:07.549] [TRACE] dateFile - 78ms: account/account/callback.json [2018-08-31T18:16:07.575] [TRACE] dateFile - 26ms: cart/cart/merge.json [2018-08-31T18:16:08.018] [TRACE] dateFile - 147ms: cart/cart/get_list.json [2018-08-31T18:16:08.024] [TRACE] dateFile - 154ms: promotion/coupon/get_list
请大神帮忙看一下。
server_tokens off; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 20m; sendfile on; tcp_nopush on; keepalive_timeout 60; keepalive_requests 10000; tcp_nodelay off; proxy_connect_timeout 10; proxy_read_timeout 600; proxy_send_timeout 600; proxy_buffer_size 64k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; fastcgi_connect_timeout 10; fastcgi_send_timeout 60; fastcgi_read_timeout 60; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k;
这是Beta 服务器nginx的基础配置
我分析感觉像是beta服务器配置的问题,因为beta服务器是运维统一配置。 我看了下没有upstream的配置信息。 我再着手解决,如果我解决了,我会回来回复的。 也请看到帖子的,有遇到相似问题的,帮我分析下哈。
好像找到问题了,initial connection 有时候巨长