Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

dbf2mysql parameter, WWWXXXAPC, wwwxxxAPC, How to unsubscrube from dategen spam, docmd.close 2585, WWWXXXDOCO, nu vot, dhcpd lease file "binding state", WWWXXXDOCO, how to setup procmail to process html2text

Links

XODOX
Impressum

#1: php file loading performance

Posted on 2008-01-30 03:16:04 by drblitzkrieg

Hi,

I have php-cgi (compiled with --enable-fastcgi --enable-force-cgi-
redirect --enable-discard-path --with-mysql --with-mysqli --enable-
embedded-mysqli --with-zlib-dir=/usr/lib) being used by FastCGI
(FCGIWrapper) to load scripts. Even with a php accelerator (see
php.ini contents below), the binary itself is being kept running with
FastCGI as expected, but it still re-loads the php file itself with
the open( ) syscall every time the browser requests it. Does the sapi/
cgi php have an option to keep all the php files it's called in its
memory space and never touch the disk or call open( ) again?


in php.ini:
[............]
extension="apc.so"
apc.enabled=1
apc.shm_segments=1
apc.shm_size=128
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
;apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.enable_cli=1
apc.include_once_override=1
apc.stat=0
[............]

Thx.

--
Blitzen

Report this message

#2: Re: php file loading performance

Posted on 2008-01-30 12:08:49 by ivansanchez-alg

Blitzen wrote:

> Does the sapi/cgi php have an option to keep all the php files it's called
> in its memory space and never touch the disk or call open( ) again?

Why bother? The OS will have that file cached to memory...

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

"The difference between pornography and erotica is lighting."
- Gloria Leonard

Report this message

#3: Re: php file loading performance

Posted on 2008-01-30 16:30:35 by quamis

On Jan 30, 1:08 pm, Iv=E1n S=E1nchez Ortega <ivansanchez-...@rroba-
escomposlinux.-.punto.-.org> wrote:
> Blitzen wrote:
> > Does the sapi/cgi php have an option to keep all the php files it's call=
ed
> > in its memory space and never touch the disk or call open( ) again?
>
> Why bother? The OS will have that file cached to memory...
>
> --
> ----------------------------------
> Iv=E1n S=E1nchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
>
> "The difference between pornography and erotica is lighting."
> - Gloria Leonard

You may mount the apc temp path to a ramdisk(so the files will really
be in memory).
I dont know how apc is implemented, but most probably it will only
"intercept" opened files, but it will not disable the fopen() from php
with his own filehandlers. You may ask a question on the apc forum...
but it would be kinda dificult(read: needs lots of hacking, prone to
future bugs) to replace the fopen from php with an internal open from
the apc...

If you need fast file acceses, then disable atime when mounting the
partition with the php & apc cache scripts, and put them in a
ramdisk . I do belive that moving the apc cache to a ramdisk would be
enough, as it should check if a file had changed by only checking
filemtime(modify time).

Also pay attention to the used filesystem. from what i remember ext3
was faster for big files, while reiserfs was faster for smaller
files(this should be the case for the cache & php files). The only way
to reliable determine this is to test it yourself, there are many
flame wars started from benchmarking the file systems, with no real
conclusion in my opinion.

Report this message