Django getting slow with uwsgi

90 views
Skip to first unread message

Arink Verma

unread,
Feb 3, 2016, 9:16:34 AM2/3/16
to Django users

Hi Django Experts.

I have recently migrated my Django app to Django 1.8.8 since then I am experiencing low performance.

With cProfiling I am have generated following breakdown of time spent.

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
       49   22.043    0.450   22.044    0.450 {select.select}
        8   10.115    1.264   10.115    1.264 {method 'recv' of '_socket.socket' objects}
       16    0.088    0.005    0.088    0.005 {method 'read' of 'file' objects}
 1513/383    0.052    0.000    0.155    0.000 /usr/lib/python2.7/sre_parse.py:379(_parse)
    29469    0.041    0.000    0.051    0.000 /usr/lib/python2.7/sre_parse.py:182(__next)
       25    0.039    0.002    0.044    0.002 /usr/lib/python2.7/sre_compile.py:301(_optimize_unicode)
 2707/358    0.024    0.000    0.120    0.000 /usr/lib/python2.7/sre_compile.py:32(_compile)
      909    0.023    0.000    0.081    0.000 /usr/lib/python2.7/sre_compile.py:207(_optimize_charset)
       17    0.020    0.001    0.020    0.001 {_socket.gethostbyaddr}
        5    0.017    0.003    0.017    0.003 {_ctypes.dlopen}
    25482    0.016    0.000    0.059    0.000 /usr/lib/python2.7/sre_parse.py:201(get)
      381    0.015    0.000    0.017    0.000 /usr/local/lib/python2.7/dist-packages/django/db/models/options.py:711(_expire_cache)
       29    0.015    0.001    0.018    0.001 /usr/lib/python2.7/collections.py:237(namedtuple)
77283/75987    0.014    0.000    0.014    0.000 {len}
3603/1385    0.014    0.000    0.016    0.000 /usr/lib/python2.7/sre_parse.py:140(getwidth)
      453    0.014    0.000    0.027    0.000 /usr/local/lib/python2.7/dist-packages/django/utils/functional.py:102(__prepare_class__)
    41332    0.013    0.000    0.013    0.000 {hasattr}
  227/163    0.012    0.000    0.665    0.004 {__import__}
       16    0.012    0.001    0.012    0.001 {posix.popen}
    52522    0.011    0.000    0.011    0.000 {method 'append' of 'list' objects}

How can I indefinitely the bottleneck whether it is in uwsgi's config or Django?

uWsgi App config

<uwsgi>
    <plugin>python</plugin>
    <socket>/run/uwsgi/app/api.example.com/api.example.com.socket</socket>
    <pythonpath>/home/ubuntu/uwsgis/</pythonpath>
    <app mountpoint="/">
        <script>wsgi_configuration_module</script>
    </app>
    <master/>
    <processes>2</processes>
    <lazy-apps>true</lazy-apps>
    <harakiri>60</harakiri>
    <reload-mercy>8</reload-mercy>
    <cpu-affinity>1</cpu-affinity>
    <stats>/tmp/stats.socket</stats>
    <max-requests>20000</max-requests>
    <limit-as>2048</limit-as>
    <reload-on-as>256</reload-on-as>
    <reload-on-rss>192</reload-on-rss>
    <callable>application</callable>
    <logto>/home/ubuntu/uwsgi_core.log</logto>
    <daemonize>/home/ubuntu/uwsgi_core_daemonize.log</daemonize>
    <no-orphans/>
    <enable-threads/>
    <vacuum/>
</uwsgi>
Reply all
Reply to author
Forward
0 new messages