# Is there any considerations for not putting php scripts in tmpfs?

- Thread: https://externals.io/message/45259
- Original archive: https://news-web.php.net/php.internals/45259
- Started by Peter Wang on 2009-08-10T13:33:51+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #45259 — Peter Wang — 2009-08-10T13:33:51+00:00

URL: https://externals.io/message/45259#45259

Hi internals,
sorry if it is a wrong lists for this question.

I have read many articles/messages about using tmpfs store temp files,

for example, php session data, smarty compied templates and so on.

An obvious reason for that is: it doesn't matter about data loss caused by
machine restart/poweroff.

since it is not that difficult to restore files on a tmpfs from a disk-based
dir when machine boot up.

so may i put all my php scripts on a tmpfs to speed it up?  would that cause
other issues?

thanks for your advices.

---

## #45260 — Patrick ALLAERT — 2009-08-10T14:18:39+00:00

URL: https://externals.io/message/45259#45260 · In reply to: #45259

Hi,

2009/8/10 Peter Wang <ptr.wang@gmail.com>:
> Hi internals,
> sorry if it is a wrong lists for this question.

Indeed, this should be asked on php-general.

> I have read many articles/messages about using tmpfs store temp files,
>
> for example, php session data, smarty compied templates and so on.
>
> An obvious reason for that is: it doesn't matter about data loss caused by
> machine restart/poweroff.
>
> since it is not that difficult to restore files on a tmpfs from a disk-based
> dir when machine boot up.
>
> so may i put all my php scripts on a tmpfs to speed it up?  would that cause
> other issues?

Don't do this, Linux/Unix already cache files in memory (-> grep
^Cached /proc/meminfo).
If you want to speed up your PHP app, consider APC.

> thanks for your advices.

-- 
Patrick Allaert
---
http://code.google.com/p/peclapm/ - Alternative PHP Monitor

---

## #45267 — Nicholas Sherlock — 2009-08-12T08:37:42+00:00

URL: https://externals.io/message/45259#45267 · In reply to: #45260

Patrick ALLAERT wrote:
> Don't do this, Linux/Unix already cache files in memory (-> grep
> ^Cached /proc/meminfo).
> If you want to speed up your PHP app, consider APC.

+1 vote for APC. The performance improvement on my website was dramatic, 
I had to check the results several times before I believed it. We were a 
heavily overloaded server whose load average was 50 at peak times. A 
quick "apt-get install php-apc" reduced that load to 5.0, with just a 
32MB opcode cache.

Cheers,
Nicholas Sherlock
