From a521795ebbfd0cca3cb5f40813e44987300c0c02 Mon Sep 17 00:00:00 2001 From: Gabriel Wicke Date: Tue, 10 Jan 2012 18:16:38 +0000 Subject: [PATCH] Support If-modified-since for RawPage, fixes bug #10023. The check to WikiPage::getTouched will load the latest revision data, which is not ideal for performance. In a quick test using ab -c 100 -n 1000 and without MemCached enabled, the request rate for plain GET requests drops slightly from 108 to 104 req/second. As described in my comment https://bugzilla.wikimedia.org/show_bug.cgi?id=10023#c9, this could certainly be improved on. Overall, a few unmodified responses should still make the server-side performance impact of this patch positive, while improving client-side performance considerably for unmodified content. --- includes/actions/RawAction.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/actions/RawAction.php b/includes/actions/RawAction.php index 019d53839a..2dcc3875a3 100644 --- a/includes/actions/RawAction.php +++ b/includes/actions/RawAction.php @@ -42,6 +42,10 @@ class RawAction extends FormlessAction { return; } + if ( $this->getOutput()->checkLastModified( $this->page->getTouched() ) ) { + return; // Client cache fresh and headers sent, nothing more to do. + } + # special case for 'generated' raw things: user css/js # This is deprecated and will only return empty content $gen = $request->getVal( 'gen' ); -- 2.20.1