Re: Apache::Session and performance question

2000-09-01 Thread Greg Cope

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.
 
 - Perrin

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

Greg Cope





Re: Apache::Session and performance question

2000-08-28 Thread Chris Brooks

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?

Thanks,
Chris

Date: Tue, 22 Aug 2000 10:08:11 -0400
To: Perrin Harkins [EMAIL PROTECTED]
From: Chris Brooks [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: Apache::Session and performance question
Message-ID: [EMAIL PROTECTED]

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',
'' );

I added

$Apache::DBI::DEBUG = 1;

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

Thanks,
Chris

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.

 - Perrin

--

Chris Brooks
Director of Technology
CareScout.com
phone: (781) 431-7033 x 342





Re: Apache::Session and performance question

2000-08-28 Thread Perrin Harkins

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.

- Perrin




Re: Apache::Session and performance question

2000-08-28 Thread Chris Brooks

Perrin,

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.

Thanks again,
Chris

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.

 - Perrin

--

Chris Brooks
Director of Technology
CareScout.com
phone: (781) 431-7033 x 342





Apache::Session and performance question

2000-08-21 Thread Chris Brooks

Hi all,

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.

package Carescout::SessionHandler;
use strict;
use Apache;
use Apache::Session::DBI;

sub handler {
 my ( $r ) = shift;
 my ( $cookie ) = $r-header_in('Cookie') || undef;
 $cookie =~ s/SESSION_ID=(\w*)/$1/o;
 my ( %session );
 tie %session, 'Apache::Session::DBI', $cookie,
{DataSource = 'dbi:mysql:cs',
 UserName = 'nobody',
 Password = ''
 };
 if ( ! $session{ acl } ) {
 $session{ acl } = '0';
 }
 if ( ! $session{ uid } ) {
 $session{ uid } = '99';
 }
 if ( ! $session{ services } ) {
 $session{ services } = '0';
 }
 $r-subprocess_env( 'SESSION_ID' = $session{
_session_id } );
 $r-subprocess_env( 'UID' = $session{ uid } );
 $r-subprocess_env( 'ACL' = $session{ acl } );
 $r-subprocess_env( 'SERVICES' = $session{ services }
);
 my ( $session_cookie ) = "SESSION_ID=$session{
_session_id };path=/;";
 tied( %session)-make_modified();
 untie %session;# not sure if we need this
 $r-header_out("Set-Cookie" = $session_cookie ) if !
$cookie;
}
1;
__END__


Thanks,
Chris




Re: Apache::Session and performance question

2000-08-21 Thread Perrin Harkins

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.

- Perrin