tags:

views:

72

answers:

3

i am trying to load database values from 6 - 7 tables on a single page i.e users, their post e.g with $.load(); and it is taking from 15+ seconds to load but i want to load that page from 1-5 seconds ...i know it depends on internet connection speed but how can i do that ....

+4  A: 

You first have to identify the problem, and you've given us no information to do so.

  1. It could be your webserver. Check the latency through firebug -- this is pretty unlikely.
  2. It could be your queries. Test them and see how long they take to run.
  3. It could be your script in general. Test it and look for potential bottlenecks.
  4. It could be the webpage itself - if the PHP runs fast (queries and script) and the data loads quickly (low latency, low delivery time) then it could be the method your using to insert the data into the page itself.
Erik
but sir i have no idea what's actually going on and please could you let me know what are slow queries and fast queries by giving me some sort of examples...
Web Worm
@testkhan - you can't fix any issue - until you know what it is - and you can't "know" what the issue is until you **test** the performance. Thus step 1 is to profile the page from initial request to final rendering. How long does it take your SQL to run? How long to return the HTTPResponse? How long for the browser to receive the entire response, how long to render it to DOMCompletion? how long to get to the Onload event (e.g. page totally loaded, images and all)
scunliffe
@testkhan: let a more experienced developer or architect look at your code. Colleague? Mentor? Teacher? Hire one? With the poor information given as far and poor knowledge proven as far, it's honestly said impossible to assist you in detail from this distance. You need to do some more specific unit-testing to isolate the source of the problem. Erik has mentioned good points to concentrate on.
BalusC
Start by calling the script that produces the data you load via ajax directly, and see how long it takes to run. Is it fast? (1-2 seconds?) Then that's not your problem. Move on from there. Did you write this code yourself? Maybe you lack the knowledge to work on this code yourself.
Erik
A: 

You could postpone loading database information until after the page is loaded by requesting your data-centric components through Ajax but after adding everything up it'll probably be the same amount of time to fully load your page. Your problem is more along the lines of slow hardware, slow internet connection to/from your server. I'm guessing that you're on a shared host, which is probably why you're suffering from slower speeds.

Jarrod
A: 

How large are these tables? How much php script processing are you doing? Have you looked at how long the queries take to run, outside of any script?

Anthony Potts