Performance note with MediaWiki's PHP client

Nathan Schmidt nschmidt at gmail.com
Fri Mar 23 07:35:54 UTC 2007


If you're using the MediaWiki MogileFS.php client you may be hitting
an unnecessary timeout when writing files. I've filed a bug+patch
against this at WikiMedia.org but the code seems to have been orphaned
so here's a heads-up in the mean time.

http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/MogileClient/MogileFS.php?annotate=7483

For the current version (7483) insert the following line line 232:

curl_setopt($ch,CURLOPT_HTTPHEADER, array('Expect: '));

This will prevent a 1-second stall caused by the default 'Expect:
100-Continue' header sent after the PUT completes. Setting an empty
'Expect' header prevents libcurl from waiting for a '100 Continue'
response from the mogstored node. Yeah, not an obvious API.

We've been using a brute-force approach (hand-rolled fread/fwrite
event loop) to get around this stall but using libcurl is a lot
cleaner and much better performance for large files on a fast link.

Regards,
-Nathan / PBwiki


More information about the mogilefs mailing list