Forum Moderators: open

Message Too Old, No Replies

Slow site

         

BigBadBurrow

8:25 pm on Jun 22, 2005 (gmt 0)

10+ Year Member



I have a problem with my website - it's too slow! It uses a combination of CSS and tables, I've used CSS to do the main layout of the site, then used tables to display results from a search.

A typical results page is only about 6kB.

I've noticed that when the search is conducted and the browser is redirected to the results page that my CPU usage goes up to 100% and my computer become unresponsive until it's finished doing its 'thang'. Then the CPU usage drops to normal levels and the computer starts responding again.

Is the CPU usage going to 100% because it's rendering the HTML? It's not like it's doing anything too advanced, it's only basic CSS and HTML tables...

Does anyone have any ideas as to what's going on? I've never seen this hapen before on any other website.

Many thanks,

BBB

jatar_k

9:00 pm on Jun 22, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> results from a search

that would be the first place I would look. Is this doing a database lookup?

That could definitely cause things to slow to a crawl.

BigBadBurrow

9:16 pm on Jun 22, 2005 (gmt 0)

10+ Year Member



See I thought this too, but if the browser is still waiting for the response, i.e. the HTML code from the server, then surely the CPU usage wouldn't go to 100% since it's not actually processing anything - it's just sitting and waiting...? It certainly should make my computer unresponsive I wouldn't have thought...

BigBadBurrow

9:19 pm on Jun 22, 2005 (gmt 0)

10+ Year Member



oh forgot to answer your question, yes it is doing a database lookup - quite complicated SQL is used. so yeh I could understand it was just slow, but I don't understand where the 100% CPU usage is coming from while it's waiting.

FridayNight

9:28 pm on Jun 22, 2005 (gmt 0)

10+ Year Member



Check MySQL processes and you will see which queries take long to execute. Then you just set correct indexes and it will be 100x faster :)

Assuming that you don't perform 500 queries at your page...

BigBadBurrow

9:33 pm on Jun 22, 2005 (gmt 0)

10+ Year Member



I hope it's not a database issue, as I don't know what else I can do to optimize it. It's in 3NF and has optimized indexes already.

Even if it 'is' a database issue, why is my CPU usage going to 100%? That's my burning question. If it's waiting on a SQL query, then the CPU usage should still be normal until it receives a response from the server. Remember, the MySQL server ISN'T on my machine.

tedster

10:10 pm on Jun 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're asking exactly the right questions - can you run a utility to audit running processes on your machine and see exactly WHAT is using up those CPU cycles? Some code loop that just keeps looping while it waits for the server packets?

jatar_k

10:15 pm on Jun 22, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



this may seem obvious but you haven't specifically mentioned it

I am assuming your website is on a server somewhere and not on your local machine?

BigBadBurrow

10:56 pm on Jun 22, 2005 (gmt 0)

10+ Year Member



Yes sorry, the webserver is located elsewhere (hosted by the same company hosting the MySQL server). I'll do a bit more testing to see if I can pin point what the problem is.

BigBadBurrow

11:48 am on Jun 23, 2005 (gmt 0)

10+ Year Member



OK i found out what the problem was (quite embaressing).

I'd left an old Javascript in there which was about 4Mb in size, so every time the result page was accessed the browser was having to process this huge javascript file (hence the 100% CPU usage). Needless to say when I removed this script the search is now damn fast due to all the other optimization I'd been doing. So I guess something good has come out of it!

Thanks for all your suggestions, but this time it was my own stupidity causing the problem!