NYCPHP Meetup

NYPHP.org

[nycphp-talk] More questions about working with forms

John Campbell jcampbell1 at gmail.com
Fri Dec 14 14:52:58 EST 2007


> So you are saying that a database access is faster than a file access? I find
> that hard to believe, but do not have any evidence of the contrary.

As a general rule of thumb, databases are faster for small bits of
data and the file system is faster for larger data.  Both the
filesystem and the database have memory caches, so reading data from a
file or the database repeatedly doesn't require going to the disk.

The problem with php sessions is that they force a write on every
request, which requires going to the disk every request.  This could
be mitigated with memcached or memory tables, but that has a whole
host of other problems.  I think if i had a session performance
problem (which I don't) I'd use a hybrid database/memcached solution
that only writes if the session has actually changed.  That way, you
would only have to hit the disk if required and your would be able to
restart mysql/memcached without destroying every session.

Regards,
John Campbell



More information about the talk mailing list