prepare all your database handles only once!
read: perldoc DBI
vassst improvements will be noticed. Even if you
don't use Perl, the theory is the same.
I usually make a global-prepared-statement hash for each child and run
the prepares in a BEGIN block.
%prepped = { table => $dbh->prepare("select foo, bar from table where
baz=?"),
table2 => $dbh->prepare("select foo, bar, moo from table2 where
baz=?"),
etc...
};
<snip src=DBI.pm>
The DBI allows an application to `prepare' statements for
later execution. A prepared statement is identified by a
statement handle. We'll call the perl variable $sth.
Typical method call sequence for a select statement:
prepare,
execute, fetch, fetch, ...
execute, fetch, fetch, ...
execute, fetch, fetch, ...
</snip>
Rudy
Jason Murphy wrote:
>
> Would know some tips for DataBases? That URL you posted I had applied to
> some of my webservers and they do improve Net in many cases, not just High
> Volume servers.
>
> --
>
> Jason Murphy
> Web Developer and Systems and Database Administrator
>
> E-mail: [EMAIL PROTECTED]
> URL: http://www.lawinfo.com
> --------------------------------------------------------------
> Lawinfo.com - Legal Industry Marketing for the 21st Century
> Phone: 800-397-3743 Fax: 800-220-4546
> --------------------------------------------------------------
> ----- Original Message -----
> From: "Rudy" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Tuesday, June 20, 2000 9:28 PM
> Subject: hello world benchmarks...
>
> >
> > Here are some new stats for Joshua's benchmarks:
> > http://www.chamas.com/bench/index.html
> > ------------------------------------------
> > Machine:
> > OS: FreeBSD 4.0-STABLE
> > cpu: PII-300
> > session: no
> > client: ab
> > From: local
> > Notes: I had to tune the TCP/IP stack...
> > FreeBSD straight off the web does not
> > have settings good for ab tests or high
> > traffice websites. Here are some of the
> > tweaks I made:
> >
> >
> http://www.freebsd.org/cgi/getmsg.cgi?fetch=131178+134382+/usr/local/www/db/
> text/1999/freebsd-net/19990725.freebsd-net
> > ------------------------------------------
> >
> >
> > ------------------------------------------
> > Test one:
> > webserver: Apache 1.3.12/mod_perl 1.23
> > application: mod_perl
> > ------------------------------------------
> > Server Software: Apache/1.3.12
> > Server Hostname: localhost
> > Server Port: 80
> >
> > Document Path: /hello
> > Document Length: 11 bytes
> >
> > Concurrency Level: 5
> > Time taken for tests: 30.008 seconds
> > Complete requests: 10540
> > Failed requests: 0
> > Total transferred: 1634165 bytes
> > HTML transferred: 115973 bytes
> > Requests per second: 351.24
> > Transfer rate: 54.46 kb/s received
> >
> > Connnection Times (ms)
> > min avg max
> > Connect: 0 3 12
> > Processing: 6 10 51
> > Total: 6 13 63
> >
> > ------------------------------------------
> > Test two:
> > webserver: Apache 1.3.12/mod_perl 1.23
> > application: static_html
> > ------------------------------------------
> > Server Software: Apache/1.3.12
> > Server Hostname: localhost
> > Server Port: 80
> >
> > Document Path: /h.htm
> > Document Length: 12 bytes
> >
> > Concurrency Level: 5
> > Time taken for tests: 30.003 seconds
> > Complete requests: 19603
> > Failed requests: 0
> > Total transferred: 5803968 bytes
> > HTML transferred: 235296 bytes
> > Requests per second: 653.37
> > Transfer rate: 193.45 kb/s received
> >
> > Connnection Times (ms)
> > min avg max
> > Connect: 0 1 10
> > Processing: 4 6 17
> > Total: 4 7 27
> >
> > ------------------------------------------
> > Test three:
> > webserver: Apache 1.3.12 (different httpd with no mod_perl!)
> > application: static_html
> > ------------------------------------------
> > Server Software: Apache/1.3.12
> > Server Hostname: localhost
> > Server Port: 80
> >
> > Document Path: /h.htm
> > Document Length: 12 bytes
> >
> > Concurrency Level: 5
> > Time taken for tests: 30.004 seconds
> > Complete requests: 20605
> > Failed requests: 0
> > Total transferred: 5275648 bytes
> > HTML transferred: 247296 bytes
> > Requests per second: 686.74
> > Transfer rate: 175.83 kb/s received
> >
> > Connnection Times (ms)
> > min avg max
> > Connect: 0 1 26
> > Processing: 3 5 7
> > Total: 3 6 33