我们使用NodeJs做服务器开发,使用的是Express框架,数据库用的阿里云的MySQL RDS,nodejs连接mysql的包选用的是mysql(https://www.npmjs.com/package...
这几天只要UV上到1000,就会出现“跟数据库有关的请求无返回”的情况,一直是pending状态。页面都能正常返回。重启一下服务器就又好了。
从服务器后台和数据库服务器后台的日志中都看不到任何错误,监控也都正常。
请问这是什么情况啊?该怎么解决?
PS:我们现在的数据库操作代码都是抄的网上的入门级教程,在实际应用中总感觉不够靠谱。请问哪里可以找到企业级的MySQL数据库操作教程啊,比如要考虑哪些方面,如何编写可靠的数据库代码等。多谢
Let me tell you my personal guess. The connection pool is not used. The connection is not closed. Open mysql show processlist; take a look at the connection
It should be that the process is hanging. You should install a connect-timeout component and set it to return a 503 timeout message if there is no response for 3 seconds. In addition, use a daemon process to keep the node.js server running. We have just started using express. After completing a project, the daemon process used is strongloop, and I am worried about the problem you mentioned. At present, this is all we can think of here. There is also a book on nodejs and express development. There is also some content in this book that can help you. Yes, we choose the ORM framework of sequelize to operate the database. We hope to have more exchanges
Personally, I think @Mrxiuxiu is right. Is it because the link is up but not released?