passenger passenger_log_file 日志分析
2015-12-31 16:26
302 查看
passenger passenger_log_file 日志分析
通过日志来分析相关逻辑及调优,主要使用正则表达式来找出具体源文件位置。App pid stdout 正则表达式App.+?stdout
日志输出: App 7375 stdout: App 7383 stdout: App 7391 stdout: App 7401 stdout:
在Spawner.h中
string readMessageLine(Details &details) { TRACE_POINT(); while (true) { string result = details.io.readLine(1024 * 4, &details.timeout); string line = result; if (!line.empty() && line[line.size() - 1] == '\n') { line.erase(line.size() - 1, 1); } if (result.empty()) { // EOF return result; } else if (startsWith(result, "!> ")) { P_DEBUG("[App " << details.pid << " stdout] " << line); result.erase(0, sizeof("!> ") - 1); return result; } else { if (details.stderrCapturer != NULL) { details.stderrCapturer->appendToBuffer(result); } printAppOutput(details.pid, "stdout", line.data(), line.size()); } } }
通过文件名和代码内容能看出为spawn进程时所产生日志。
Disconnecting long-running connections for process 20545正则表达式Disconnecting long-running connections for process
static void abortLongRunningConnections(const ApplicationPool2::ProcessPtr &process) { // We are inside the ApplicationPool lock. Be very careful here. WorkingObjects *wo = workingObjects; P_NOTICE("Disconnecting long-running connections for process " << process->getPid() << ", application " << process->getGroup()->getName()); for (unsigned int i = 0; i < wo->threadWorkingObjects.size(); i++) { wo->threadWorkingObjects[i].bgloop->safe->runLater( boost::bind(abortLongRunningConnectionsOnController, wo->threadWorkingObjects[i].controller, process->getGupid().toString())); } }
通过函数名和逻辑可判断为进程在达到最大空闲时间后,被kill进程时输出的日志。
Returning HTTP 503 due to: Request queue full (configured max. size: 100) Returning HTTP
在CheckoutSession.cpp文件中void Controller::writeRequestQueueFullExceptionErrorResponse(Client *client, Request *req, const boost::shared_ptr<RequestQueueFullException> &e) { TRACE_POINT(); const LString *value = req->secureHeaders.lookup( "!~PASSENGER_REQUEST_QUEUE_OVERFLOW_STATUS_CODE"); int requestQueueOverflowStatusCode = 503; if (value != NULL && value->size > 0) { value = psg_lstr_make_contiguous(value, req->pool); requestQueueOverflowStatusCode = stringToInt( StaticString(value->start->data, value->size)); } SKC_WARN(client, "Returning HTTP " << requestQueueOverflowStatusCode << " due to: " << e->what()); endRequestWithSimpleResponse(&client, &req, "<h2>This website is under heavy load (queue full)</h2>" "<p>We're sorry, too many people are accessing this website at the same " "time. We're working on this problem. Please try again later.</p>", requestQueueOverflowStatusCode); }
明显此处Request queue full,并且返回给用户This website is under heavy load的页面,默认为最大为100,具体可以查看官方文档 。注意此处为达到最大的队列大小的原因是什么如果确实是请求并发高,可以加大该队列大小,但是如果为慢查询连接未被释放,则需要自己查看原因,而不是盲目加大该参数。
相关文章推荐
- 一文读懂机器学习,大数据/自然语言处理/算法全有了……
- __init__.py 包文件
- C# 格式字符串的格式项
- 深入浅出jsonp
- Unity 官方 Demo: 2DPlatformer 的 SLua 版本。
- Spring进阶教程之在ApplicationContext初始化完成后重定义Bean
- python两个列表合并
- Android ImageView ScaleType清晰记录
- 搜索功能优化,性能优化比较,dom,dom4j,json
- 向下兼容win server2003系统的远程服务器
- Android之JAVASe基础篇-面向对象-IO(九)
- Web应用跨域访问解决方案汇总
- Android——ViewPgaer切换动画
- 检测到无法访问的代码?
- JUnit:使用ExpectedException进行异常测试
- Saitama Destroys Hotel
- 099_二分图判定
- ReactNativeiOS(三)开发零碎2 DatePickerIOS propType warning 4个
- Python学习笔记——dict和set
- leetCode26:Remove Duplicates from Sorted Array