Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 21st, 2007, 11:25 AM   #1
FireflyX
PHP God
 
FireflyX's Avatar
 
Join Date: Nov 2007
Location: Stockton, England
Posts: 15
Rep Power: 0 FireflyX is on a distinguished road
Send a message via MSN to FireflyX
Wink I need speed increase

I just finished my active users script for my site and we all see active users lists on lots of sites and forums but i thought i'd try and make mine a bit more interesting by making it every once in a while without you having to reload the page. The script itself works fine but after about a minute the site just freezes. Now i really want to have the script there because it's a lot better than your ordinary boring active users list but i was wondering is there any way i can stop this freezing from happening. Here is the code i'm using to achieve this:

function Active (){

  self.status = "Sending request"

  initialize();
  xmlHttp.onreadystatechange=function()
  {
    if(xmlHttp.readyState == 4){

      var active = document.getElementById('active');
      active.innerHTML = xmlHttp.responseText 

    }
  }
  xmlHttp.open("GET", 'http://www.staticfire.co.uk/ajaxrequest.php?cmd=active',true);
  xmlHttp.send(null);

}


var delay = 20000
var timerID = setInterval("Active()", delay)

Do you think it is this that is causing the freezing or the would it most likely be the PHP causing it?

-Thanks for your time
__________________
mysql_query("DELETE chavs FROM earth") or die("chavs");
FireflyX is offline   Reply With Quote
Old Dec 21st, 2007, 11:33 AM   #2
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,730
Rep Power: 5 Sane is on a distinguished road
Re: I need speed increase

Switch the URL to something static. Maybe 'http://www.staticfire.co.uk/ajaxrequest.html'.

Make sure the page exists.

Then run that for a couple minutes. See if it still freezes. This will help isolate your problem, because it will help determine whether it's JS, or PHP, that's causing the problem.
Sane is offline   Reply With Quote
Old Dec 21st, 2007, 11:44 AM   #3
FireflyX
PHP God
 
FireflyX's Avatar
 
Join Date: Nov 2007
Location: Stockton, England
Posts: 15
Rep Power: 0 FireflyX is on a distinguished road
Send a message via MSN to FireflyX
Re: I need speed increase

Good idea.

And the result is as i feared: the PHP is causing it and i don't know how to increase the speed. UPDATE is one of the slowest MySQl quieries and it is being used in that file. If i were to post the PHP here do you think anyone would be able to increase the speed of it?
__________________
mysql_query("DELETE chavs FROM earth") or die("chavs");
FireflyX is offline   Reply With Quote
Old Dec 21st, 2007, 11:46 AM   #4
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,730
Rep Power: 5 Sane is on a distinguished road
Re: I need speed increase

Well I believe I already previously attempted to fix your query. Hopefully you applied, or at least tested, my suggestions. Go ahead and post it here. Someone will help you I'm sure.
Sane is offline   Reply With Quote
Old Dec 21st, 2007, 11:54 AM   #5
FireflyX
PHP God
 
FireflyX's Avatar
 
Join Date: Nov 2007
Location: Stockton, England
Posts: 15
Rep Power: 0 FireflyX is on a distinguished road
Send a message via MSN to FireflyX
Re: I need speed increase

What? When did you do this?

Edit: Oh it seems i posted a thread here about my site being slow before. I forget Anyway I did try out what suggested but it still seems to be slow. Anyway i'll try and speed it up a bit myself then i might have to post the code if it continues to be slow.
__________________
mysql_query("DELETE chavs FROM earth") or die("chavs");

Last edited by FireflyX; Dec 21st, 2007 at 12:11 PM.
FireflyX is offline   Reply With Quote
Old Dec 22nd, 2007, 9:55 AM   #6
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,730
Rep Power: 5 Sane is on a distinguished road
Re: I need speed increase

Also, don't spend too much time hitting your keyboard over this. One possibility could be poor MySQL support by your hosting service. There are different degrees of speed, caching, and size, that your hosting service can set restrictions upon. Make sure you aren't doing anything that would cause them to delay you between queries.
Sane is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Option to increase the number of threads listed peace_of_mind Community Announcements and Feedback 6 Jul 21st, 2006 6:41 AM
Why MHz isn't a good measurement of speed when comparing Intel and AMD a thing Coder's Corner Lounge 6 Dec 18th, 2005 11:57 AM
Darkhack's cpu speed tester JDStud6 C# 6 Dec 17th, 2005 6:44 PM
fastest download speed darkone916 Coder's Corner Lounge 17 Aug 1st, 2005 10:22 PM
speed script Bmxer_Jake JavaScript and Client-Side Browser Scripting 2 Jun 25th, 2005 11:36 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:30 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC