]> git.ipfire.org Git - thirdparty/patchwork.git/commit
api: Only provide JSON version of events list
authorDaniel Axtens <dja@axtens.net>
Mon, 12 Mar 2018 12:08:54 +0000 (23:08 +1100)
committerDaniel Axtens <dja@axtens.net>
Thu, 5 Apr 2018 09:21:07 +0000 (19:21 +1000)
commit90d9ee14e73e8ec9248e89c788d64867c4a4bb74
tree55c8962166be7bf02b43cf9b48e5232f38e34b4d
parent5d9b00409fcafc7b8cd09400195c9c9f1b3e4fcc
api: Only provide JSON version of events list

Something is very, very slow in the d-r-f browsable API events renderer.

In my MySQL test (~33k patches), the CPU time to render the events list
is ~11s, and the time taken by SQL queries is only ~3s. If the JSON
renderer is used, that drops to 0.2s for the entire page (because less
CPU is used, and - for some as yet unknown reason - a *very* expensive
db query is dropped.)

In my PostgreSQL test (~100k patches), the results are even more stark:
30s of CPU time and 0.2s of DB time goes to 0.25s for the entire page.

Something is seriously, seriously wrong with whatever d-r-f is doing.
So, simply render the event list as unlinked JSON for now.

There are a few followups we should do, but this is an important start -
no-one should be able to DoS a patchwork server by just enumerating the
events!

In particular, we should find out:
 - why postgres and mysql behaviour is so different.
 - what on earth d-r-f is doing that makes rendering the pretty-printed
   version so incredibly slow.

Signed-off-by: Daniel Axtens <dja@axtens.net>
patchwork/api/event.py
patchwork/templates/patchwork/event-list.html [new file with mode: 0644]