PHP execution time is too high

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
itsmarc's picture

Currently I am working on a site which have lots of modules enabled (around 120). This is intranet application where only login screen and contact form is only anonymous user can access.

OG groups is one of the main aspects on this site. Every user should be a member of one or more groups. And we have implemented some node access implementations . So the site become very dynamic and every user will see different data. So most of the cache module won't help me.

Our server configuration is AMD 2000+, 1.5 GB DDR RAM, 160GB Hard Drive.

Software stack - PHP 5.2.13 with APC, MySQL 5.x

Currently the average page execution time was 2500 ms for normal page without any blocks. In this total execution time sql query only took 50ms which is ok. But the php execution time is too high.

I have made some tweaks on APC & Mysql

APC:
apc.shm_size=64
apc.include_once_override=1
apc.max_file_size=10M

MYSQL:
query-cache-size=50M

Is there any cache module available to help me?

Comments

Hi, This is cool article

creaoy's picture

Hi,

This is cool article about apc configuration http://2bits.com/articles/high-php-execution-times-drupal-and-tuning-apc...
Basically you need to look at apc.php and see if everything ok with Hits.

Thanks for the information. I

itsmarc's picture

Thanks for the information. I have already tried adjust various configuration in apc but I can't make it less that 2000ms. Is there any well know good apc configuration for drupal.

My current apc configuration is this,

apc.cache_by_default On
apc.coredump_unmap Off
apc.enable_cli On
apc.enabled On
apc.file_update_protection 2
apc.filters no value
apc.gc_ttl 3600
apc.include_once_override On
apc.max_file_size 10M
apc.mmap_file_mask /tmp/apc.IUj4te
apc.num_files_hint 1024
apc.report_autofilter Off
apc.rfc1867 Off
apc.rfc1867_freq 0
apc.rfc1867_name APC_UPLOAD_PROGRESS
apc.rfc1867_prefix upload_
apc.shm_segments 1
apc.shm_size 64
apc.slam_defense 0
apc.stat On
apc.stat_ctime Off
apc.ttl 7200
apc.user_entries_hint 4096
apc.user_ttl 7200
apc.write_lock On

Any advise!

What % of hits and misses do

creaoy's picture

What % of hits and misses do you have from apc.php script?

APC info is, Memory

itsmarc's picture

APC info is,

Memory Usage:
Free: 22.7 MBytes (35.5%)
Used: 41.3 MBytes (64.5%)

Hits & Misses:
Hits: 6425 (92.0%)
Misses: 561 (8.0%)

Fragmentation: 0%

Well, APC configuration looks

creaoy's picture

Well, APC configuration looks fine.

I think with this amount of modules bottleneck is processor.

How much memory are you

john.oltman's picture

How much memory are you giving PHP? Is the average page time of 2sec under load, or just one user?

I would recommend install

gansbrest's picture

I would recommend install some kind of profiler like xdebug and check your slow pages to see where php spends most of execution time. Otherwords - find the problem first before fixing it.

xdebug

mikeytown2's picture

+1 for xdebug
http://xdebug.org/

@john.oltman - Memory limit

itsmarc's picture

@john.oltman - Memory limit for php is 96Mb & yes the average time for the page request is 2sec not under load.

@gansbrest - I have already installed xdebug on my machine and I am trying to find out bottlenecks. But the problem is I can't pinpoint any place where lots of the time spent by php instead the time is spread across various section in code. I am keep trying on it and let you know if I find out anything interesting.

On a box with that many

john.oltman's picture

On a box with that many modules and 1.5GB of memory, I'd give PHP 512 MB and see if that helps. I'd also look at your Apache config and make sure you aren't launching too many instances - perhaps a max clients of 10 or 15. Your machine may thrash if too many instances are launched.

On a box with that many

dalin's picture

On a box with that many modules and 1.5GB of memory, I'd give PHP 512 MB and see if that helps.

I don't think that makes any sense. The PHP memory limit is just that - a limit. If PHP uses more memory than that at one time the process is killed. So either your pages work, or they are terminated for using too much memory. This has nothing to do with page load time.

I'd also look at your Apache config and make sure you aren't launching too many instances - perhaps a max clients of 10 or 15. Your machine may thrash if too many instances are launched.

This also has nothing to do with page load time (unless the machine is swapping, but the OP said 2 secs was the page generation time under nominal server load). Max clients does relate to scalability, but performance != scalability.

--


Dave Hansen-Lange
Director of Technical Strategy, Advomatic.com
Pronouns: he/him/his

Good points, but since I'm

john.oltman's picture

Good points, but since I'm not monitoring the server to confirm anything, it doesn't hurt to tune the server and see if it helps, in my view. What if his nominal load occurred today, but yesterday was a high load? Then his server has lots of instances out there, and the nominal load is dealing with the aftermath. In general though, I agree with you.

You can attach (or put to

gansbrest's picture

You can attach (or put to dropbox if it's too big) your profiling information (file you got after running xdebug with profiling flag) so we could see what's in there.

On windows

DraconPern's picture

Took me.. a year to figure out that on Windows, you should use Wincache instead of apc. makes it so much faster. http://www.iis.net/download/wincacheforphp

+1 for WinCache PHP

vidichannel's picture

Amen. New 1.1 Wincache is really great for me. Don't know what they did, but it sure works the best for IIS.