Talk about bang for the buck. I was just able to boost performance of a mod_perl script over 60x by changing a single line of code. This was on an apache_1.3.29/mod_perl-1.29 using MySQL 4.0.16 and running on Red Hat Linux 9. (I'm guessing that's not a very exotic combo at all :-)
Here was the problem:
$query->bind_param(1,$mailbox);
By eliminating that single line of code and incorporating the $mailbox var right in my $sql string:
select foo from from bar where mailbox = $mailbox
instead of
select foo from from bar where mailbox = ?
Has anyone seen this happen before? Is the problem specific to MySQL or general across all DBI connections? Is a bind_param call slowing your code down somewhere? Or was I just doing something The Wrong Way before?
Phil
#with bind_param
$ ab -n100 -c10 'http://127.0.0.1/run/checkmail?mailbox=test' | grep R
+equest
Requests per second: 1.23 [#/sec] (mean)
#removed bind_param
$ ab -n100 -c10 'http://127.0.0.1/run/checkmail?mailbox=test' | grep R
+equest
Requests per second: 77.77 [#/sec] (mean)
Edited by BazB moved from Meditations to SoPW
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.