#25684: Runserver doesn't use `LOGGING` configuration
-----------------------------------+------------------------------------
     Reporter:  fcurella           |                    Owner:  fcurella
         Type:  New feature        |                   Status:  assigned
    Component:  Error reporting    |                  Version:  master
     Severity:  Normal             |               Resolution:
     Keywords:  runserver logging  |             Triage Stage:  Accepted
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+------------------------------------

Comment (by fcurella):

 Since `runserver` is not supposed to be used in production, I'm really
 concerned about performance. I've namespaced the logger so the formatter
 should never be called in production (assuming no-one uses `runserver` in
 production)

 I've done some profiling anyway, and here are the results:

 on `master`, `DEBUG = False`:

 `ab -k -n 15000 http://127.0.0.1:8000/`:

 {{{
 Concurrency Level:      1
 Time taken for tests:   22.961 seconds
 Complete requests:      15000
 Failed requests:        0
 Non-2xx responses:      15000
 Keep-Alive requests:    0
 Total transferred:      3435000 bytes
 HTML transferred:       1110000 bytes
 Requests per second:    653.28 [#/sec] (mean)
 Time per request:       1.531 [ms] (mean)
 Time per request:       1.531 [ms] (mean, across all concurrent requests)
 Transfer rate:          146.09 [Kbytes/sec] received

 Connection Times (ms)
               min  mean[+/-sd] median   max
 Connect:        0    0   0.1      0       5
 Processing:     1    1   0.4      1      29
 Waiting:        1    1   0.3      1      28
 Total:          1    2   0.4      1      29
 ERROR: The median and mean for the total time are more than twice the
 standard
        deviation apart. These results are NOT reliable.

 }}}

 on `master`, `DEBUG = True`:

 `ab -k -n 15000 http://127.0.0.1:8000/`:

 {{{
 Concurrency Level:      1
 Time taken for tests:   23.380 seconds
 Complete requests:      15000
 Failed requests:        0
 Keep-Alive requests:    0
 Total transferred:      28725000 bytes
 HTML transferred:       26505000 bytes
 Requests per second:    641.57 [#/sec] (mean)
 Time per request:       1.559 [ms] (mean)
 Time per request:       1.559 [ms] (mean, across all concurrent requests)
 Transfer rate:          1199.81 [Kbytes/sec] received

 Connection Times (ms)
               min  mean[+/-sd] median   max
 Connect:        0    0   0.1      0       4
 Processing:     1    1   0.8      1      98
 Waiting:        1    1   0.8      1      98
 Total:          1    2   0.8      1      98
 WARNING: The median and mean for the total time are not within a normal
 deviation
         These results are probably not that reliable.
 }}}

 Post-patch, `DEBUG = False`:

 `ab -k -n 15000 http://127.0.0.1:8000/`:

 {{{
 Concurrency Level:      1
 Time taken for tests:   20.975 seconds
 Complete requests:      15000
 Failed requests:        0
 Non-2xx responses:      15000
 Keep-Alive requests:    0
 Total transferred:      3435000 bytes
 HTML transferred:       1110000 bytes
 Requests per second:    715.14 [#/sec] (mean)
 Time per request:       1.398 [ms] (mean)
 Time per request:       1.398 [ms] (mean, across all concurrent requests)
 Transfer rate:          159.93 [Kbytes/sec] received

 Connection Times (ms)
               min  mean[+/-sd] median   max
 Connect:        0    0   0.1      0       5
 Processing:     1    1   0.5      1      52
 Waiting:        1    1   0.5      1      52
 Total:          1    1   0.5      1      52

 }}}

 Post-patch, `DEBUG = True`:

 `ab -k -n 15000 http://127.0.0.1:8000/`:

 {{{
 Concurrency Level:      1
 Time taken for tests:   24.314 seconds
 Complete requests:      15000
 Failed requests:        0
 Keep-Alive requests:    0
 Total transferred:      28725000 bytes
 HTML transferred:       26505000 bytes
 Requests per second:    616.92 [#/sec] (mean)
 Time per request:       1.621 [ms] (mean)
 Time per request:       1.621 [ms] (mean, across all concurrent requests)
 Transfer rate:          1153.71 [Kbytes/sec] received

 Connection Times (ms)
               min  mean[+/-sd] median   max
 Connect:        0    0   1.3      0     139
 Processing:     1    2   2.9      1     127
 Waiting:        1    1   2.4      1     127
 Total:          1    2   3.2      1     140
 }}}

 Note that the patch skips the formatter if `DEBUG` is `False` by using the
 `require_debug_true` filter.

 Without the filter, the results are:

 Post-patch, `DEBUG = False`, no filter:

 `ab -k -n 15000 http://127.0.0.1:8000/`:

 {{{
 Concurrency Level:      1
 Time taken for tests:   21.105 seconds
 Complete requests:      15000
 Failed requests:        0
 Non-2xx responses:      15000
 Keep-Alive requests:    0
 Total transferred:      3435000 bytes
 HTML transferred:       1110000 bytes
 Requests per second:    710.72 [#/sec] (mean)
 Time per request:       1.407 [ms] (mean)
 Time per request:       1.407 [ms] (mean, across all concurrent requests)
 Transfer rate:          158.94 [Kbytes/sec] received

 Connection Times (ms)
               min  mean[+/-sd] median   max
 Connect:        0    0   0.1      0       6
 Processing:     1    1   0.3      1      29
 Waiting:        1    1   0.3      1      29
 Total:          1    1   0.4      1      29
 }}}

 Post-patch, `DEBUG = True`, no filter:

 `ab -k -n 15000 http://127.0.0.1:8000/`:

 {{{
 Concurrency Level:      1
 Time taken for tests:   23.068 seconds
 Complete requests:      15000
 Failed requests:        0
 Keep-Alive requests:    0
 Total transferred:      28725000 bytes
 HTML transferred:       26505000 bytes
 Requests per second:    650.24 [#/sec] (mean)
 Time per request:       1.538 [ms] (mean)
 Time per request:       1.538 [ms] (mean, across all concurrent requests)
 Transfer rate:          1216.02 [Kbytes/sec] received

 Connection Times (ms)
               min  mean[+/-sd] median   max
 Connect:        0    0   0.1      0      12
 Processing:     1    1   0.5      1      59
 Waiting:        1    1   0.5      1      59
 Total:          1    2   0.6      1      59
 WARNING: The median and mean for the total time are not within a normal
 deviation
         These results are probably not that reliable.

 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25684#comment:11>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.deac9f97c2717b639f498a89b00d5364%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to