3

I am running wampserver on my windows vista machine. I have been doing this for a long time and it has been working great. I have completed loads of projects with this setup.

However, today, without me changing anything (no configuration etc) only PHP code changes, I find that every time I load pages of my site (those with user sessions or access the database) are really slow to load - Over 30 seconds, they use to take 1 or 2 seconds.

When I have a look at the task manager, I can see on page loads the httpd process jumps from 10mb to 30mb, 90mb, 120mb, 250mb and then back down again.

I have tested previous php code projects and they seem to all be slow as well!

What is going on?

Thanks all for any help on this confusion issue!

Abs
  • 56,052
  • 101
  • 275
  • 409
  • Whats the ini setting in play for memory_limit? It shouldn't be more than 32M which would prevent this ever happening in your PHP code. – symcbean May 05 '10 at 16:49
  • This doesn't exactly solve the problem? All that will happen is that PHP will give a fatal error of memory couldn't be allocated. I still have the problem of what is causing this! – Abs May 07 '10 at 12:06
  • Has your database access library been updated (i'm assuming your sessions are stored here too)? Have you changed any configuration to cache in the database? Have you added compression or any other item to the httpd configuration? – marr75 May 07 '10 at 15:29
  • 1
    Your database queries might be returning a large amount of data. You should check to see if that is the case. – John Coates May 07 '10 at 15:30
  • limiting the PHP memory will tell you a lot about where the memory leak is occurring and how to fix it. You're not going likely to get a silver bullet solution without a lot of investigation - which only you can do - we can only suggest how to progress your investigation. – symcbean May 12 '10 at 11:04

5 Answers5

1

Check the following:

  • Check if you your data-access library to access your database has been changed/updated lately (if you use one).
  • Just a guess, but did you changed your antivirus/firewall (or settings) since last time you checked those previous projects? A more aggresive security can slow things a lot.
  • Did you changed the Apache/PHP/MySQL version in the WAMPSERVER menu?
  • Maybe you can try to reinstall WAMPSERVER (do this last and if it's not an hassle for you because I really doubt this will help but it can in some really really weird cases).

But from experience and the memory usage you explain in your question it seems that your SQL queries are long to execute and/or return a really large data set.

Try to optimise your queries, it can help for speed but not really memory usage (at least if the result set is the same). For the memory, maybe you can use LIMIT to reduce your returning data set (if your design allows it - but it should).

Since we don't really know what you do with your data, take note than "playing" (like parsing large XML documents) with large data sets can take much time/memory (again it depends much on what you do with all this data).

Bottom line, if nothing in this post helps, try to post more information on your setup and what exactly you do (with even code samples) when it's slow.

AlexV
  • 22,658
  • 18
  • 85
  • 122
1

Try checking the size of your wamp log files.

i.e.

C:\wamp\logs

Sometimes, when they get really big, they can cause Apache to slow down.

JW.
  • 4,821
  • 5
  • 43
  • 60
1

Have you recently changed your network configuration or upgraded your system? That may be causing this issue through your network config or anti-virus/security software. People have had issues with zonealarm causing this in the past, for example.

Also, if you've recently switched from typing "127.0.0.1" to "localhost" or moved around networks, you may benefit from removing the IPV6 localhost setting from C:\Windows\System32\drivers\etc\hosts if you have one:

change the line with

::1             localhost

to

# ::1             localhost
corprew
  • 1,991
  • 14
  • 17
1

I am surprised that no one has suggested this. You should always try to see why things are really slowing down:

Use Performance monitor to see where the bottleneck is, first. (perfmon.exe) Is hard page fault actually the bottleneck? Is your hard drive busy reading/writing to the pagefile? Check the length of IO queue for the hard disk. Are CPUs busy?

If nothing looks busy, use procmon to see if your php process is blocked on some system calls.

Hope this helps.

wbkang
  • 2,136
  • 1
  • 15
  • 22
1

though not related to finding database bottlenecks, XDebug in combination with a cachegrind viewer (e.g. WebGrind, WinCacheGrind) can help you find the part of your PHP code, that takes longest to execute.

Dormilich
  • 927
  • 5
  • 11