image.png

    第一时间刷新了一把发布系统,发现确实很卡,很多请求都在pending,很遗憾,我又加剧了这种情况
    随后上服务器
    1、ps -ef |grep project_name
    2、jstat

    1. [nobody@BJGS-APP-101 logs]$ /usr/local/jdk1.8.0_112/bin/jstat -gcutil 9115 1000
    2. S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
    3. 0.00 99.35 24.22 70.49 96.20 95.51 847 12.381 8 2.449 14.830
    4. 0.00 99.35 24.92 70.49 96.20 95.51 847 12.381 8 2.449 14.830
    5. 0.00 99.35 25.91 70.49 96.20 95.51 847 12.381 8 2.449 14.830
    6. 0.00 99.35 28.39 70.49 96.20 95.51 847 12.381 8 2.449 14.830
    7. 0.00 99.35 28.59 70.49 96.20 95.51 847 12.381 8 2.449 14.830
    8. 0.00 99.35 30.66 70.49 96.20 95.51 847 12.381 8 2.449 14.830
    9. 0.00 99.35 32.51 70.49 96.20 95.51 847 12.381 8 2.449 14.830

    正常/合理
    3、jstack

    1. ^C[nobody@BJGS-APP-101 logs]$ /usr/local/jdk1.8.0_112/bin/jstack 9115 |more
    2. 2021-03-31 10:06:56
    3. Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.112-b15 mixed mode):
    4. "Attach Listener" #9592 daemon prio=9 os_prio=0 tid=0x00007f0c08003000 nid=0x1579e waiting on condition [0x0000000000000000]
    5. java.lang.Thread.State: RUNNABLE
    6. "http-nio-9292-exec-212" #9590 daemon prio=5 os_prio=0 tid=0x00007f0ad0008800 nid=0x15751 runnable [0x00007f09361e7000]
    7. java.lang.Thread.State: RUNNABLE
    8. at java.net.SocketInputStream.socketRead0(Native Method)
    9. at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
    10. at java.net.SocketInputStream.read(SocketInputStream.java:170)
    11. at java.net.SocketInputStream.read(SocketInputStream.java:141)
    12. at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:114)
    13. at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:161)
    14. at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189)
    15. - locked <0x00000000c79c5bc8> (a com.mysql.jdbc.util.ReadAheadInputStream)
    16. at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2500)
    17. at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2953)
    18. at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2942)
    19. at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3485)
    20. at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1960)
    21. at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2114)
    22. at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2696)
    23. - locked <0x00000000c79c5d40> (a java.lang.Object)
    24. at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2105)
    25. at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1367)
    26. - locked <0x00000000c79c5d40> (a java.lang.Object)
    27. at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)
    28. at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
    29. at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2927)
    30. at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:118)
    31. at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)
    32. at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:185)
    33. at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)
    34. at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)
    35. at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForObject(MappedStatement.java:120)
    36. at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:518)
    37. at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:493)
    38. at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
    39. at org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:273)
    40. at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:203)
    41. at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:271)
    42. at com.alibaba.cobarclient.MysdalSqlMapClientTemplate.queryForObject(MysdalSqlMapClientTemplate.java:246)
    43. at com.raycloud.project.manager.dao.UserDAO.getUserByName(UserDAO.java:129)
    44. at com.raycloud.project.manager.filter.CheckFilter.doFilter(CheckFilter.java:71)
    45. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    46. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    47. at com.raycloud.rayauth.AuthFilter.doActionFilter(AuthFilter.java:242)
    48. at com.raycloud.rayauth.AuthFilter.doFilter(AuthFilter.java:142)
    49. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    50. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    51. at com.raycloud.project.manager.filter.SessionFilter.doFilter(SessionFilter.java:30)
    52. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    53. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    54. at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
    55. at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    56. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    57. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    58. at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    59. at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    60. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    61. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    62. at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
    63. at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    64. at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
    65. at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    66. at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    67. at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
    68. at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    69. at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    70. at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
    71. at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    72. at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
    73. at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
    74. at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    75. - locked <0x00000000f6d14950> (a org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper)
    76. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    77. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    78. at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    79. at java.lang.Thread.run(Thread.java:745)
    80. "http-nio-9292-exec-211" #9588 daemon prio=5 os_prio=0 tid=0x00007f0ad405b800 nid=0x15749 runnable [0x00007f09362e8000]
    81. java.lang.Thread.State: RUNNABLE
    82. at java.net.SocketInputStream.socketRead0(Native Method)
    83. at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
    84. at java.net.SocketInputStream.read(SocketInputStream.java:170)
    85. at java.net.SocketInputStream.read(SocketInputStream.java:141)
    86. at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:114)
    87. at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:161)
    88. at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189)
    89. - locked <0x00000000f719a230> (a com.mysql.jdbc.util.ReadAheadInputStream)
    90. at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2500)
    91. [nobody@BJGS-APP-101 logs]$

    emmm , 2个线程都在RDS,立刻查看RDS是否存在慢SQL

    image.png

    deal
    1、找到对应的业务
    2、先添加timeout,重启
    3、优化SQL