Opened 4 years ago

Closed 4 years ago

#16499 closed Cleanup/optimization (wontfix)

Improve load template performance

Reported by: blacktear23 Owned by: nobody
Component: Template system Version: 1.3
Severity: Normal Keywords: Performance
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

After add a template cache, the performance of render a template is more faster.
I use apache benchmark do a test, as a result it will improve performance more than 2 times:

disable template cache:

Concurrency Level: 1
Time taken for tests: 29.380 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 6496000 bytes
HTML transferred: 6349000 bytes
Requests per second: 34.04 #/sec (mean)
Time per request: 29.380 [ms] (mean)
Time per request: 29.380 [ms] (mean, across all concurrent requests)
Transfer rate: 215.92 [Kbytes/sec] received

enable template cache:

Concurrency Level: 1
Time taken for tests: 11.639 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 6496000 bytes
HTML transferred: 6349000 bytes
Requests per second: 85.92 #/sec (mean)
Time per request: 11.639 [ms] (mean)
Time per request: 11.639 [ms] (mean, across all concurrent requests)
Transfer rate: 545.04 [Kbytes/sec] received

Attachments (1)

loader.py.diff (850 bytes) - added by blacktear23 4 years ago.
Add template cache

Download all attachments as: .zip

Change History (2)

Changed 4 years ago by blacktear23

Add template cache

comment:1 Changed 4 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

I think you might want to take a look at the template caching feature added in Django 1.2. The approach you've applied here won't share anything between processes, and will result in a massive memory blowout as common templates are cached independently in each process.

Note: See TracTickets for help on using tickets.
Back to Top