# new ini parser, caching

- Thread: https://externals.io/message/32236
- Original archive: https://news-web.php.net/php.internals/32236
- Started by Alexey Zakhlestin on 2007-09-11T09:03:39+00:00
- Messages: 5
- 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

---

## #32236 — Alexey Zakhlestin — 2007-09-11T09:03:39+00:00

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

> > […]
>
> Just clarification: the caching is there already. :)
> But I didn't use any stat calls for sake of KISS.
> When cached results expire, the file (if it exists..) is re-scanned.
> Maybe someone has better idea. But that remains to be seen. :)

well, some OSes allow subscribing to the notifications from filesystem
*bsd (including macos-x) use kqueue, linux and winnt have different
mechanisms for the same thing

-- 
Alexey Zakhlestin
http://blog.milkfarmsoft.com/

---

## #32261 — Stanislav Malyshev — 2007-09-11T16:34:46+00:00

URL: https://externals.io/message/32236#32261 · In reply to: #32236

> well, some OSes allow subscribing to the notifications from filesystem
> *bsd (including macos-x) use kqueue, linux and winnt have different
> mechanisms for the same thing

The question is how expensive are those notifications - i.e. if one has 
1000 of them, will it be a trouble for the OS?
-- 
Stanislav Malyshev, Zend Software Architect
stas@zend.com   http://www.zend.com/
(408)253-8829   MSN: stas@zend.com

---

## #32269 — Pierre — 2007-09-11T19:45:54+00:00

URL: https://externals.io/message/32236#32269 · In reply to: #32261

> > […]
>
> The question is how expensive are those notifications - i.e. if one has
> 1000 of them, will it be a trouble for the OS?

It is not really related to the stat cache but it may need a
clarification. The ini cache works on per directory basis and caches
the entries found in the current dir and the parent directories.

Once the TTL is over, it will check if there is a file in the current
dir and its parent directory (until docroot), just like htaccess.
Having this TTL reduces the performance impact drastically. For
example, htscanner has it set to 5mins by default. For what I heard,
many ISPs kept this default.

Cheers,
--Pierre

---

## #32279 — Alexey Zakhlestin — 2007-09-12T06:32:05+00:00

URL: https://externals.io/message/32236#32279 · In reply to: #32269

> 
> > […]
>
> It is not really related to the stat cache but it may need a
> clarification. The ini cache works on per directory basis and caches
> the entries found in the current dir and the parent directories.
>
> Once the TTL is over, it will check if there is a file in the current
> dir and its parent directory (until docroot), just like htaccess.
> Having this TTL reduces the performance impact drastically. For
> example, htscanner has it set to 5mins by default. For what I heard,
> many ISPs kept this default.

kqueue and "friends" allow you to skip that TTL part alltogether, as
PHP can just register itself as a subscriber to filesystem events in
related directories. If it notices that the file appeared or
disappeared or changed it can react immediately, while still not
making any "active" checks

but, as Stanislav mentioned, we should check how difficult it would be
for the OS to send those notifications

-- 
Alexey Zakhlestin
http://blog.milkfarmsoft.com/

---

## #32280 — Pierre — 2007-09-12T07:49:52+00:00

URL: https://externals.io/message/32236#32280 · In reply to: #32279

> kqueue and "friends" allow you to skip that TTL part alltogether, as
> PHP can just register itself as a subscriber to filesystem events in
> related directories. If it notices that the file appeared or
> disappeared or changed it can react immediately, while still not
> making any "active" checks

(Warning: I never used these systems so I may be mistaken)

Unless they have a local session manager   that allows php to register
once, get a SID and re connect on each request to fetch/catch the
notifications, it can't be used. It may be possible to store the
connection data and information in a persistent storage but the
problem of the notifcations remain, how will they be sent to PHP?

The advantage of a TTL system is its extreme simplicity and
portability (cache works per process child and work on every platform
supported by PHP).

Cheers,
--Pierre
