当前位置: 代码迷 >> 综合 >> jython load 高的分析
  详细解决方案

jython load 高的分析

热度:28   发布时间:2023-12-21 17:36:45.0
登录到s4发现load很高,cpu完全是被jython占用,发现启jstack主要被三种线程占用:
1. memcached
2. perf/models.py:30,next_blog_id(),prev_blog_id()这个地方绝对有性能问题导致mysql被lock。
{code}
at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189)
- locked <0x0000000778151558> (a com.mysql.jdbc.util.ReadAheadInputStream)
at django.db.models.query$py._result_iter$8(/duitang/dist/sys/tomcat/webapps/ROOT/WEB-INF/lib-python/Lib/site-packages/django/db/models/query.py:99)
{code}
3. 抛出的异常打印stack可能会非常耗时:
{code}
java.lang.Thread.State: RUNNABLE
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Throwable.java:782)
- locked <0x000000074c3389a8> (a org.python.core.PyException)
{code}


{code}
at django.db.models.query$py.call_function(/duitang/dist/sys/tomcat/webapps/ROOT/WEB-INF/lib-python/Lib/site-packages/django/db/models/query.py)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyGenerator.__iternext__(PyGenerator.java:149)
at org.python.core.PyGenerator.__iternext__(PyGenerator.java:131)
at perf.models$py.get_recs$1(/data1/duitang/dist/app/test/jython/duitang/../duitang/perf/models.py:30)
at perf.models$py.call_function(/data1/duitang/dist/app/test/jython/duitang/../duitang/perf/models.py)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:166)
at org.python.core.PyFunction.__call__(PyFunction.java:368)
at message.models$py.fetch_pre_blog$66(/duitang/dist/sys/tomcat/webapps/ROOT/WEB-INF/lib-python/duitang/message/models.py:723)
at message.models$py.call_function(/duitang/dist/sys/tomcat/webapps/ROOT/WEB-INF/lib-python/duitang/message/models.py)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:134)
at org.python.core.PyFunction.__call__(PyFunction.java:347)
at org.python.core.PyMethod.__call__(PyMethod.java:109)
at message.models$py.get_prev_blog$65(/duitang/dist/sys/tomcat/webapps/ROOT/WEB-INF/lib-python/duitang/message/models.py:709)
at message.models$py.call_function(/duitang/dist/sys/tomcat/webapps/ROOT/WEB-INF/lib-python/duitang/message/models.py)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:134)
at org.python.core.PyFunction.__call__(PyFunction.java:347)
at org.python.core.PyMethod.__call__(PyMethod.java:109)
at message.models$py.prev_blog_id$64(/duitang/dist/sys/tomcat/webapps/ROOT/WEB-INF/lib-python/duitang/message/models.py:701)

{code}
  相关解决方案