← Back to team overview

brainstorm-dev team mailing list archive

Re: variably slow

 

On Thu, Dec 4, 2008 at 4:49 PM, Edward Quick <edwardquick@xxxxxxxxxxx> wrote:
> Hi,

Hello,

>
> I've written a single sign on script for brainstorm which works on the
> premise that the userid and mail headers get sent through after
> authentication takes place (in our case via ldap).
>
> Also note I had to apply a small patch
> http://drupal.org/files/issues/sess.patch which is detailed here =>
> http://drupal.org/node/293612
>
> The only drawkback I'm finding is that it can be quite slow on my site where
> I get about 5 hits a second during peak times. I noticed it's not just the
> single sign on either, but sometimes when I click on one of the most popular
> links, the page can be quite slow to come back. I'm using the current ubuntu
> brainstorm site version, and even that site is variably slow at times.

The SQL ordering used on the frontpage is quite CPU intensive,
especially when you get lots of items.
The very first step in order to get some great improvment is to enable
Drupal caching (but not the Drupal aggressive caching). This will
boost the average answer time, since lots of users are usually not
logged, and the Drupal cache is serving cached pages to non-logged
users.
For even further improvement, consider using a separate cache(squid,
...) instead of the Drupal one, which rely on the database.

I hope this will help. By curiosity, are you using ideatorrent for a
public website? You seems to be talking about a lot of traffic there.
And btw, please now use the mailing lists at
http://www.ideatorrent.org, I'll close this one.

Cheers,
Nicolas

>
> There do not appear to be any resource issues on the box, so I'm guessing I
> need to tune something, or index a table in the database? Thanks for any
> help.
>
> Ed.
>
>
> <?php
>
> include_once './includes/bootstrap.inc';
> global $user;
> drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);  //  not sure if this is the
> bootstrap phase required
>
> //some things to configure
> $url="https://ideas.somdomain.com/";;
> $db="brainstorm;
> $dbhost="brainhost";
> $dbuser="brainuser";
> $dbpasswd="brainpass";
>
> //user dummy password
> $pass="dummypassword";
> $hashpasswd="60da11eb799d6a8da47e5cd6e4aa2273";
>
>
> //pick up the SSO headers
> $name=$_SERVER['HTTP_SSO_UNIQUENAME'];
> $mail=$_SERVER['HTTP_SSO_MAIL'];
>
>
> //check sso values
> if(empty($name)||empty($mail)){
>         header  ("Location: ".$url."/error.html");
> }
>
>
> // Create user if they don't exist by looking to see if email address
> already registered
> $dbconn = pg_connect("host=$dbhost dbname=$db user=$dbuser
> password=$dbpasswd") or die('Could not connect: ' . pg_last_error());
> $query = "select count(*) from users where mail='".$mail."'";
> $result = pg_query($query) or die('Query failed: ' . pg_last_error());
> $line = pg_fetch_array($result, null, PGSQL_ASSOC);
> pg_free_result($result);
> $userExist=(int)$line['count'];
> if( $userExist < 1 ){
>         $time=time();
>         $query = "INSERT INTO users
> (name,pass,mail,theme,created,status,timezone,init,data) VALUES
> ('".$name."','".$passwd."','".$mail."','ubuntu-theme','
> ".$time."','1','0','".$mail."','a:0:{}')";
>         $result = pg_query($query) or die('Query failed: ' .
> pg_last_error());
>         pg_free_result($result);
> }
> pg_close($dbconn);
>
> //Now do the drupal authentication
> $user=user_authenticate($name, $pass);
> if ($user){
>     drupal_goto("$url");
> }
>
>
> ?>
>
>
> ________________________________
> Take your friends with you with Mobile Messenger. Click Here!
> _______________________________________________
> Mailing list: https://launchpad.net/~brainstorm-dev
> Post to     : brainstorm-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~brainstorm-dev
> More help   : https://help.launchpad.net/ListHelp
>
>



References