modperl-apache_session_performance_db_be_slow_especially_without_table_index

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



Date: Mon, 28 Aug 2000 14:55:58 -0400
From: Chris Brooks <cbrooks@carescout.com>
To: modperl@apache.org
Subject: Re: Apache::Session and performance question

Chris Brooks <cbrooks@carescout.com> wrote: 

>>Perrin Harkins wrote:

> > On Mon, 21 Aug 2000, Chris Brooks wrote:
> > We have a fairly simple handler responsible for maintaining
> > state on our web server.  Unfortunately, when we activate
> > it, server performance drops to about 1/10th of what it is
> > without.   After going through the handler and commenting
> > out parts and benchmarking (rinse, repeat), Apache::Session
> > appears to be the culprit.
> >
> > I can't believe that the use of this module should have so
> > great an effect.  We have to be doing something
> > incorrectly.   Any advice would be greatly appreciated.
>
> You are using Apache::DBI, right?
>
> Going to the database on every single request is going to be
> expensive.  If the rest of your application doesn't normally hit the
> database it makes sense for this to have a significant impact.

>Hi, thanks for the reply,

>Yes, we are calling the module from http.conf like this:

>PerlModule Apache::DBI
>PerlRequire /www/perl/scripts/perl-startup.pl
>PerlHeaderParserHandler Carescout::SessionHandler

>The referenced startup script contains the line:

>Apache::DBI->connect_on_init( 'DBI:mysql:cs', 'nobody',
>'xxxxxxxx' );

>I added

>$Apache::DBI::DEBUG = 1;

>to the startup file, and it doesn't seem to be creating a
>new connection for every request.


Hi again to the list,

I went back through the documentation on Apache::Session,
Apache::Session::DBIStore, and Apache::DBI, and I haven't found a
problem in the way we have implemented this.  Does anyone else have
suggestions, or has anyone else experienced a similar performance hit?

===

Date: Mon, 28 Aug 2000 13:13:49 -0700 (PDT)
From: Perrin Harkins <perrin@primenet.com>
To: Chris Brooks <cbrooks@carescout.com>
Subject: Re: Apache::Session and performance question

On Mon, 28 Aug 2000, Chris Brooks wrote:
> I went back through the documentation on Apache::Session,
> Apache::Session::DBIStore, and Apache::DBI, and I haven't found a
> problem in the way we have implemented this.  Does anyone else have
> suggestions, or has anyone else experienced a similar performance hit?

You're not doing anything wrong.  As I said before, going to a databse on
every request is expensive.  It will definitely crush your performance
when compared to something really lightweight like serving static files
with no db access.  You could try using one of the other session stores
like FileStore to see if it's any faster for you, or you could try running
MySQL on the same machine as the web server, but if you have significant
traffic you will eventually need a separate db server machine and a
cluster of web servers.

The only thing I could suggest for improving the performance of your setup
is to make sure you have MySQL properly tuned, with an appropriate index
on this table.

===
Date: Mon, 28 Aug 2000 16:50:57 -0400
From: Chris Brooks <cbrooks@carescout.com>
To: Perrin Harkins <perrin@primenet.com>
Subject: Re: Apache::Session and performance question

Perrin Harkins wrote:

> On Mon, 28 Aug 2000, Chris Brooks wrote:
> > I went back through the documentation on Apache::Session,
> > Apache::Session::DBIStore, and Apache::DBI, and I haven't found a
> > problem in the way we have implemented this.  Does anyone else have
> > suggestions, or has anyone else experienced a similar performance hit?
>
> You're not doing anything wrong.  As I said before, going to a databse on
> every request is expensive.  It will definitely crush your performance
> when compared to something really lightweight like serving static files
> with no db access.  You could try using one of the other session stores
> like FileStore to see if it's any faster for you, or you could try running
> MySQL on the same machine as the web server, but if you have significant
> traffic you will eventually need a separate db server machine and a
> cluster of web servers.
>
> The only thing I could suggest for improving the performance of your setup
> is to make sure you have MySQL properly tuned, with an appropriate index
> on this table.

Thanks for the replies.  Adding an index made a significant improvement on
performance -- it's still three or four times slower than without
Apache::Session, but much faster than without the index.

===

Date: Fri, 01 Sep 2000 10:36:37 +0000
From: Greg Cope <gjjc@rubberplant.freeserve.co.uk>
To: Perrin Harkins <perrin@primenet.com>
Subject: Re: Apache::Session and performance question

Perrin Harkins wrote:
> 
> On Mon, 28 Aug 2000, Chris Brooks wrote:
> > I went back through the documentation on Apache::Session,
> > Apache::Session::DBIStore, and Apache::DBI, and I haven't found a
> > problem in the way we have implemented this.  Does anyone else have
> > suggestions, or has anyone else experienced a similar performance hit?
> 
> You're not doing anything wrong.  As I said before, going to a databse on
> every request is expensive.  It will definitely crush your performance
> when compared to something really lightweight like serving static files
> with no db access.  You could try using one of the other session stores
> like FileStore to see if it's any faster for you, or you could try running
> MySQL on the same machine as the web server, but if you have significant
> traffic you will eventually need a separate db server machine and a
> cluster of web servers.
> 
> The only thing I could suggest for improving the performance of your setup
> is to make sure you have MySQL properly tuned, with an appropriate index
> on this table.

I think Perrin has already touched on this and it may be too obvious,
but if you are session managing all requests you are wasting alot of
time on non-html / dynamic content such as images, style sheets.

===





the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu