[nycphp-talk] More questions about working with forms
Rob Marscher
rmarscher at beaffinitive.com
Fri Dec 14 14:51:03 EST 2007
On Dec 14, 2007, at 1:41 PM, David Krings wrote:
> John Campbell wrote:
>>> Is there anything drastically flawed with my approach?
>>>
>> Since you understand the pitfalls of your approach and choose to do
>> it
>> that way it is not a problem. You are also using sessions to prevent
>> repeated hits to the database for "performance reasons". Don't do
>> that. It typically makes performance worse because session data must
>> be serialized and written to disk on every request even if the data
>> doesn't change.
>
> 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.
I would guess it depends on a number of factors -- like whether or not
the session file is in the OS filesystem cache, what type of hard
drive you are using, etc. I think the point John was making is that
if the data doesn't change you might be able to recognize that there
was no change and not write the session data at the end of the
request. With php's default session handler, it's going to write to
the session file at the end of every request. If you're not working
on a medium to high volume traffic site, the performance difference
probably isn't a big deal.
More information about the talk
mailing list