Here is some more performance results based on Ruediger's suggestion : ------------------------------------------------------------------------- test2.html : 500 substitution s/hello/hi/g. Requests Per Second (RPS) as measured by ab for s/hello/hi/ substitution. Enabled CPUs : 1 testname Concur MaxReq mod_sed mod_line_edit mod_substitute mod_substitute(with n flag) RPS RPS RPS test2.html 100 100000 1278 404 1130 1531
Summary : On simple string substitution (s/hello/hi/) mod_sed perform better than mod_substitue but with flag [n] mod_substitute performed better than mod_sed. ------------------------------------------------------------------------- Test case summary : pattern capture Regular expression used : OutputSed 's/.*\(one\).*\(two\).*\(three\).*\(four\).*\(five\).*/\5 \4 \3 \2 \1/' : Substitute "s/.*(one).*(two).*(three).*(four).*(five).*/$5 $4 $3 $2 $1/" String : hello one 1 two 2 three 3 four 4 five 5. Enabled CPUs : 4 test12.html : 500 lines containing the above string (Result in 500 substitution). testname Concur MaxReq mod_sed mod_substitute RPS RPS test12.html 125 100000 1322 3230 Summary : With pattern capture, mod_substitute performed much better than mod_sed. ------------------------------------------------------------------------- Test case summary : test for simple regular expression. Regular expression used : OutputSed 's/.*one.*two/1 2/' : Substitute "s/.*one.*two/1 2/" String : hello one 1 two 2 three 3 four 4 five 5. Enabled CPUs : 4 test22.html : 500 lines containing the above string (Result in 500 substitution). testname Concur MaxReq mod_sed mod_substitute RPS RPS test22.html 400 400000 2013 1689 Summary : With ordinary regular expression, mod_sed performed better than mod_substitute. ------------------------------------------------------------------------- mod_substitute (what is available in 2.2.8 is leaking memory) so the above performance results must be repeated with new mod_substitute from trunk (to have better comparison). Regards, Basant. On Thu, Apr 10, 2008 at 01:44:53PM +0200, Ruediger Pluem wrote: > On 10.04.2008 13:27, Jim Jagielski wrote: >> >> On Apr 9, 2008, at 5:09 PM, Basant Kukreja wrote: >>>> just that, too. Any performance comparisons with its competitors? >>> Some quick performance comparison results between mod_sed, mod_line_edit >>> and >>> mod_substitute. >>> >>> Search/Replace string : s/hello/hi/ >>> test0.html : No matches, so no substitute. >>> test.html : 1 comparision/substitute >>> test2.html : 500 comparision/substitute >>> >>> Performance data was generated with 200 clients for 100000 requests (for >>> worker >>> mpm). >>> $ ab -c 200 -n 100000 <http-uri> >>> >>> Requests Per Second (RPS) as measured by ab for s/hello/hi/ substitution. >>> mod_sed mod_line_edit >>> mod_substitute >>> test0.html 3263 3206 3129 >>> test.html 3229 3213 3197 >>> test2.html 1278 404 1130 >>> >>> Note that mod_sed performs better than either mod_line_edit or >>> mod_substitute. >> >> Interesting... What versions of each did you test? > > Would be interesting to know what happens speed wise if you use the n flag > for mod_substitute to use strmatch instead of a regular expression. > And depending on the version you used it would be interesting what happens > if you use the q flag (applys only to trunk). > Furthermore from a first glance of mod_sed I would guess that it runs into > trouble with large static files. So could you test mod_sed with one of > the simple cases above and a 3 GB file and monitor httpd's memory consumption > in comparison to mod_substitute? > > Regards > > RĂ¼diger > >