Django suddenly get very heavy and slow


Today i found something weird with my django applications. Suddenly, it became heavy and slow. It took 100 to 150 % of Python process. Sometimes I saw this error :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Traceback (most recent call last):
  File "/home/tripvillas/.virtualenvs/trip/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 284, in run
    self.finish_response()
  File "/home/tripvillas/.virtualenvs/trip/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 324, in finish_response
    self.write(data)
  File "/home/tripvillas/.virtualenvs/trip/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 403, in write
    self.send_headers()
  File "/home/tripvillas/.virtualenvs/trip/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 467, in send_headers
    self.send_preamble()
  File "/home/tripvillas/.virtualenvs/trip/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 385, in send_preamble
    ‘Date: %srn’ % http_date()
  File "/usr/lib64/python2.7/socket.py", line 324, in write
    self.flush()
  File "/usr/lib64/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe

After looking at different part, then I found the culprit was Django Debug Toolbar. Indeed, after i disabled django-debug-toolbar, suddenly it became fast again! Weird!


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.