Force PHP CLI to stay in RAM?
Force PHP CLI to stay in RAM?
am 25.12.2007 04:00:16 von DFS
Hello
I have a couple of command-line PHP scripts that are often called, and
I was wondering if it were possible to have the PHP interpreter remain
in RAM instead of being removed after the scipts end?
Thank you.
Re: Force PHP CLI to stay in RAM?
am 25.12.2007 05:25:38 von petersprc
Hi,
You can certainly do this. The script can sit in a loop waiting for an
indication to continue such as a socket connection, a file on disk
being modified, a posix signal, an update in a database, a timer, etc.
On Dec 24, 10:00 pm, Gilles Ganault wrote:
> Hello
>
> I have a couple of command-line PHP scripts that are often called, and
> I was wondering if it were possible to have the PHP interpreter remain
> in RAM instead of being removed after the scipts end?
>
> Thank you.
Re: Force PHP CLI to stay in RAM?
am 25.12.2007 21:21:26 von ivansanchez-alg
Gilles Ganault wrote:
> I have a couple of command-line PHP scripts that are often called, and
> I was wondering if it were possible to have the PHP interpreter remain
> in RAM instead of being removed after the scipts end?
If the script is called often enough, they *will* stay in memory. It's
something called "the operating system automatically caches the most
recently used files".
You are trying to do premature optimization. Don't.
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
Las deudas son como los niños; cuanto más pequeñas, más ruido hacen.
Re: Force PHP CLI to stay in RAM?
am 26.12.2007 04:09:43 von DFS
On Tue, 25 Dec 2007 21:21:26 +0100, Iván Sánchez Ortega
wrote:
>If the script is called often enough, they *will* stay in memory. It's
>something called "the operating system automatically caches the most
>recently used files".
OK, I'll just let Linux handle this, and come back if it's too slow
;-) I wanted to have your opinion because the scripts are used with a
PBX, so that timing is important.
Re: Force PHP CLI to stay in RAM?
am 26.12.2007 12:31:27 von ivansanchez-alg
Gilles Ganault wrote:
> I wanted to have your opinion because the scripts are used with a
> PBX, so that timing is important.
Then, keep the scripts short and use efficient algorithms. Knowing the
difference between O(n^2) and O(n*log(n)) is much more important than
keeping the script in memory.
That said, if you *really* need a real-time response on a mission-critical
environment, drop PHP altogether and switch to rtlinux, lighthttpd and a
custom C CGI.
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
MSN:i_eat_s_p_a_m_for_breakfast@hotmail.com
Jabber:ivansanchez@jabber.org ; ivansanchez@kdetalk.net
Re: Force PHP CLI to stay in RAM?
am 26.12.2007 13:09:08 von Courtney
� wrote:
> Gilles Ganault wrote:
>
>> I wanted to have your opinion because the scripts are used with a
>> PBX, so that timing is important.
>
> Then, keep the scripts short and use efficient algorithms. Knowing the
> difference between O(n^2) and O(n*log(n)) is much more important than
> keeping the script in memory.
>
>
> That said, if you *really* need a real-time response on a mission-critical
> environment, drop PHP altogether and switch to rtlinux, lighthttpd and a
> custom C CGI.
>
:-)
he's right you know.
But real time usually just mens 'good enough' - only in real mans stuff
does it mean 'guaranteed to always be good enough'
i.e. you do NOT want your missile to decide to go memory garbage
collecting 5 ms after launch.. ;-)and self destruct when it misses a
watchdog timer..
Re: Force PHP CLI to stay in RAM?
am 26.12.2007 23:28:44 von DFS
On Wed, 26 Dec 2007 12:09:08 +0000, The Natural Philosopher
wrote:
>But real time usually just mens 'good enough' - only in real mans stuff
>does it mean 'guaranteed to always be good enough'
OK, I'll see how PHP does and see if timing is an issue. Thanks.