Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Apache on Mac OS X = Slow

Apache on Mac OS X = Slow
Thread Tools
jasonlustig
Fresh-Faced Recruit
Join Date: Jul 2005
Status: Offline
Reply With Quote
Aug 6, 2005, 10:34 PM
 
So I just got my first powerbook a few weeks ago - and it is amazing! I really like it a lot. The one problem I have been having with it is that I do freelance web programming, and do most of the testing locally. I set up Apache and PHP5 on my PB, but it is really, really slow - somewhere along the lines of 20-30 seconds to load up a page. When I load a regular HTML page, it is pretty fast, but whenever it uses PHP extensively it takes forever.

Is there any way to speed up apache? It's making testing and getting work done a pain.

thanks,
Jason
     
frates
Junior Member
Join Date: May 2003
Location: France
Status: Offline
Reply With Quote
Aug 7, 2005, 08:28 AM
 
how did you set up your apache/php ?
you used a package somewhere ? which one ? from source ? which versions ?
can you throw in here a phpinfo(); ?

There's clearly a config problem, that's nowhere near normal.
     
madmacgames
Grizzled Veteran
Join Date: Oct 2003
Status: Offline
Reply With Quote
Aug 7, 2005, 11:44 AM
 
Yeah that is not normal... I also have a development server on my 12" powerbook running Apache, PHP 4, MySQL 4, PostgreSQL 8, Subversion, etc... When loading a PHP page locally, it takes at most 1 or 2 seconds longer to parse the PHP than it does on a dedicated production server, depending upon what all else I've got running at the time on my powerbook.

Have you tested other script? Could there be something info your script causing the delay?

Have you tried a very simple script like <?php phpinfo(); ?> to see if it too have problems?
The only thing necessary for evil to flourish is for good men to do nothing
- Edmund Burke
     
jasonlustig  (op)
Fresh-Faced Recruit
Join Date: Jul 2005
Status: Offline
Reply With Quote
Aug 8, 2005, 12:07 AM
 
Hi everyone!

I set up apache with the version that was pre-installed with OSX, and I used the PHP5 package from http://www.entropy.ch/software/macosx/php/. phpinfo() works fine, but otherwise doing things takes a long long time. I don't have anything special set up that would cause it to slow down, I don't think. Maybe it just needs more memory so that the PB can keep apache in the memory instead of having to put it in the swapfile?

Jason
     
madmacgames
Grizzled Veteran
Join Date: Oct 2003
Status: Offline
Reply With Quote
Aug 8, 2005, 08:48 AM
 
How much memory do you currently have?

Also, when I set my dev server up, I noticed that Apache by default was setup to spawn servers as if it was in a production environment... In activity monitor, how many processes are running for httpd?

And also, what are you settings for the following in httpd.conf: MinSpareServers, MaxSpareServers, and StartServers? I have changed mine to be:

MinSpareServers 1
MaxSpareServers 5
StartServers 1

I'm still inclined to say that there is maybe something not quite right with your scripts. You might also want to check your httpd error log (you can find this in the Console app under your /var/log tree).
The only thing necessary for evil to flourish is for good men to do nothing
- Edmund Burke
     
jasonlustig  (op)
Fresh-Faced Recruit
Join Date: Jul 2005
Status: Offline
Reply With Quote
Aug 8, 2005, 09:14 AM
 
Currently I have 512 mb of ram, though I've been thinking of getting an extra 512 or gig, because I tend to have a lot of things open. I've taken to closing most of my programs except the ones I really need when I do web development work though, to up the amount of free ram.

In the activity monitor, I believe apache usually has at least 4 or 5 httpd processes. I was wondering about this and wasn't sure if this is just the way apache acts under unix (I've mainly had experience running apache on a windows dev machine) or if it is unusual. I'm not sure what I have for the MinSpareServers and other settings, and I can't check now since I don't have my mac with me at the moment.

In terms of the scripts, as far as I know there is nothing very heavy-duty about them except that they load a lot of different files. There are a decent amount of libraries, and the code is modularized and stuff, so that the script might end up loading around 8 or 9 files in order to put everything together. With the 5400 rpm drive though, I thought this would be less of an issue.... also i know it is not the database, because my scripts output sql query times for debugging purposes, and the sql times are normal.

Jason
     
madmacgames
Grizzled Veteran
Join Date: Oct 2003
Status: Offline
Reply With Quote
Aug 8, 2005, 09:29 AM
 
Originally Posted by jasonlustig
In terms of the scripts, as far as I know there is nothing very heavy-duty about them except that they load a lot of different files. There are a decent amount of libraries, and the code is modularized and stuff, so that the script might end up loading around 8 or 9 files in order to put everything together. With the 5400 rpm drive though, I thought this would be less of an issue....
Loading 8 or 9 file includes is nothing for a PHP script. In the application I am currently developing, at least 50-100 files are included on each page from the app's library. My average local parse time is about 1.5 seconds.

When you get back to your Mac, I'd open the console and the httpd error log, and then run one of your scripts and look for any glaring errors entered as it runs.

Failing to find anything from that, I guess just try lowering the number of httpd servers.

And failing that to have an effect, I would install a PHP script known to work well, and see if it has the same problems running locally as your script does.

I suppose it is also possible that there might be a problem with the PHP 5 package you installed; however, the place you got it from, the guy's packages have always worked well for me. I'm using his PHP 4 and PostgreSQL packages.
The only thing necessary for evil to flourish is for good men to do nothing
- Edmund Burke
     
jasonlustig  (op)
Fresh-Faced Recruit
Join Date: Jul 2005
Status: Offline
Reply With Quote
Aug 8, 2005, 05:44 PM
 
I checked my error logs and everything seems fine. Also the number of httpd servers seems the same as what you set... I'm going to try to install phpbb and see how things go.

Jason
     
jasonlustig  (op)
Fresh-Faced Recruit
Join Date: Jul 2005
Status: Offline
Reply With Quote
Aug 8, 2005, 05:52 PM
 
OK, well after installing phbb, I can report that everything seems to work fine with that script! So I don't know what's up wtih my script that's making it take forever - maybe it has to do with the fact that I'm using a templating engine (I use smarty), I'll have to benchmark it to see where the bottleneck is.

Jason
     
jasonlustig  (op)
Fresh-Faced Recruit
Join Date: Jul 2005
Status: Offline
Reply With Quote
Aug 8, 2005, 07:24 PM
 
Sorry to post for the third time in a row, but I think I found the problem and I want to let you all know! Unfortunately it's not the solution I was looking for.... it seems like the firewall is what is causing the problem, my scripts run much much faster when I turn the firewall off. It's too bad since I would like to keep the firewall on (you know, security and all that, even if it is osx), but if i need to turn if off when i do development it's not such a big deal.

:-D
jason
     
madmacgames
Grizzled Veteran
Join Date: Oct 2003
Status: Offline
Reply With Quote
Aug 9, 2005, 01:17 AM
 
is your script or page communicating with any remote locations? If so, that would be the cause of the firewall making your script slow to load, in which case you just need to open the ports you are communicating on.
The only thing necessary for evil to flourish is for good men to do nothing
- Edmund Burke
     
jasonlustig  (op)
Fresh-Faced Recruit
Join Date: Jul 2005
Status: Offline
Reply With Quote
Aug 11, 2005, 02:37 PM
 
Yeah, that's the only thing I can think of that would cause the problem. Where do I look to find the outgoing firewall log? That way I can see what it's trying to do...

Jason
     
fux0r
Fresh-Faced Recruit
Join Date: Aug 2005
Status: Offline
Reply With Quote
Aug 23, 2005, 09:56 PM
 
I have a PB G4 with 512 MB Ram running jaguar. Im doing php mysql and apache and my postnuke website is SSSSSLLLLLOOOOWWWWW. i tried turning the firewall off but it seems though it doesnt matter. any solutions?
     
mania
Mac Enthusiast
Join Date: Aug 2001
Location: Durango CO
Status: Offline
Reply With Quote
Aug 26, 2005, 11:22 PM
 
there should not be slowdowns like you guys are seeing. isn't postnuke a giant security hole anyway - or at least used to be? i say its the scripts not the powerbook, ram, apache, or mysql.
     
fux0r
Fresh-Faced Recruit
Join Date: Aug 2005
Status: Offline
Reply With Quote
Aug 27, 2005, 12:28 PM
 
What would you recommend in th elines of a CMS like postnuke?
thanks for the input.
     
mania
Mac Enthusiast
Join Date: Aug 2001
Location: Durango CO
Status: Offline
Reply With Quote
Aug 27, 2005, 12:45 PM
 
hmm, check hotscripts.com - the ones that work well are usually rated higher.
     
rossnick
Fresh-Faced Recruit
Join Date: Sep 2005
Status: Offline
Reply With Quote
Sep 2, 2005, 11:26 AM
 
I have the exact same problem on mac os X 10.4 machine.

Berfore, it was on 10.2, and all was speedy. Now, I've migrated the machine to 10.4 (complete install from scratch, apache and php custom-compiled), and all that is PHP is slow like hell...

I've done much research on google for this problem, and I've found this thread...

The php scripts taht I looking at is running with mysql on a different machine (no firewall between them). When I run it on the command line (i.e. php index.php), it returns in 1 seconds or so, it's very acceptable. When run trough apache, it takes 8 seconds and more.

I allways got very poor performance with apache 1 dso ot static, or apache 2. I've also tried every php I could find. php 4.3.9, .10, .11, php 4.4.0, 5.0. All same results. One the command line, it's verry fast, but not trough apache.

So, could you try your app on the command line and see you have the same results as me ?
     
sieb
Dedicated MacNNer
Join Date: Jan 2005
Location: Under Your Stairs
Status: Offline
Reply With Quote
Sep 3, 2005, 03:01 AM
 
Apparently, the problems with Apache/MySQL are OSX related, not system related: http://www.anandtech.com/mac/showdoc.aspx?i=2520
Sieb
Blackbook
(2Ghz, 2GB, 100Gig, week 21)
     
production_coordinator
Mac Elite
Join Date: Aug 2005
Status: Offline
Reply With Quote
Sep 3, 2005, 06:36 PM
 
Originally Posted by sieb
Apparently, the problems with Apache/MySQL are OSX related, not system related: http://www.anandtech.com/mac/showdoc.aspx?i=2520
Ha ha... no, that's not the problem the original poster is dealing with. The anandtech article is talking about medium to large volume websites... hundreds of hits per second with multiple concurrent connections...
     
rossnick
Fresh-Faced Recruit
Join Date: Sep 2005
Status: Offline
Reply With Quote
Sep 6, 2005, 10:28 AM
 
I've had the chance to further more check this problem.

We have another set of machine that we haven't all upgraded to 10.4. These are a set of 3 xserve cluster node dual g5, with 4 gigs of ram. 2 of them are running OS X Server 10.3, the 3rd is at 10.4. If I take my little setup of apache 1.3.33, with php 4.4 static, all compiled locally, with all the same configure lines, it's verry rapid on 10.3 (less than 1 second to render the page), and more than 8 to 10 seconds on 10.4... So, it is effectivly related to Mac OS X...
     
mania
Mac Enthusiast
Join Date: Aug 2001
Location: Durango CO
Status: Offline
Reply With Quote
Sep 6, 2005, 10:34 AM
 
Originally Posted by rossnick
I've had the chance to further more check this problem.

We have another set of machine that we haven't all upgraded to 10.4. These are a set of 3 xserve cluster node dual g5, with 4 gigs of ram. 2 of them are running OS X Server 10.3, the 3rd is at 10.4. If I take my little setup of apache 1.3.33, with php 4.4 static, all compiled locally, with all the same configure lines, it's verry rapid on 10.3 (less than 1 second to render the page), and more than 8 to 10 seconds on 10.4... So, it is effectivly related to Mac OS X...
its not 10.4 per se - my stock apache/php on 10.4 runs fine on my powerbook. it must have something to do with clustering or the way you compiled it.
     
rossnick
Fresh-Faced Recruit
Join Date: Sep 2005
Status: Offline
Reply With Quote
Sep 6, 2005, 10:54 AM
 
Originally Posted by mania
its not 10.4 per se - my stock apache/php on 10.4 runs fine on my powerbook. it must have something to do with clustering or the way you compiled it.
I've also tested with the stock apache, stock php, and still got verry, verry poor performance...
     
   
Thread Tools
 
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -4. The time now is 05:07 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,