473,396 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Are session data written/read back with every page?

Hello

Out of curiosity, I was wondering what happens with session data: I
read that session data are saved on disk as eg. /var/sess_ID (which is
already a performance issue since accessing a hard-drive is much
slower than reading information from RAM), but are session data
written and read back with every web page the user accesses, or does
PHP keeps those in RAM for a while to avoid this constant write/read?

Thank you.
Jun 2 '08 #1
5 1543
Gilles Ganault wrote:
Hello

Out of curiosity, I was wondering what happens with session data: I
read that session data are saved on disk as eg. /var/sess_ID (which is
already a performance issue since accessing a hard-drive is much
slower than reading information from RAM), but are session data
written and read back with every web page the user accesses, or does
PHP keeps those in RAM for a while to avoid this constant write/read?

Thank you.
It's written to disk and read back in again. But unless you have huge
amounts of data in the session (which you shouldn't), the performance
impact is virtually unnoticeable.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 2 '08 #2
..oO(Gilles Ganault)
>Out of curiosity, I was wondering what happens with session data: I
read that session data are saved on disk as eg. /var/sess_ID (which is
already a performance issue since accessing a hard-drive is much
slower than reading information from RAM), but are session data
written and read back with every web page the user accesses, or does
PHP keeps those in RAM for a while to avoid this constant write/read?
With the default session handler the data is read from and written to
disk on every single page access that uses the session. PHP doesn't do
any caching, but of course the operating system might do that.

If you're encountering performance problems, you should profile your
code to find the real bottlenecks. Disk accesses are usually not the
problem.

Micha
Jun 2 '08 #3
On Tue, 27 May 2008 12:57:24 +0200, Michael Fesser <ne*****@gmx.de>
wrote:
>With the default session handler the data is read from and written to
disk on every single page access that uses the session. PHP doesn't do
any caching, but of course the operating system might do that.
Thanks guys.
Jun 2 '08 #4
On May 27, 11:41 am, Gilles Ganault <nos...@nospam.comwrote:
Hello

Out of curiosity, I was wondering what happens with session data: I
read that session data are saved on disk as eg. /var/sess_ID (which is
already a performance issue since accessing a hard-drive is much
slower than reading information from RAM), but are session data
written and read back with every web page the user accesses, or does
PHP keeps those in RAM for a while to avoid this constant write/read?

Thank you.
The session data is indeed stored on disk, but it's not read in unless
you do a session_start (). Frequently accessed files are usually
cached by the OS and/or hard drive on-board cache so as long as you're
not cramming massive amounts of data into a session the filesystem
latency should be a non-issue.
Jun 2 '08 #5
rf
Michael Fesser <ne*****@gmx.dewrote in
news:v1********************************@4ax.com:
With the default session handler the data is read from and written to
disk on every single page access that uses the session. PHP doesn't do
any caching, but of course the operating system might do that.
The operating system most certainly *will* do that.

--
Richard
Killing all google groups posts
The Usenet Improvement Project: http://improve-usenet.org
Jun 2 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
27
by: mrbog | last post by:
Tell me if my assertion is wrong here: The only way to prevent session hijacking is to NEVER store authentication information (such as name/password) in the session. Well, to never authenticate...
8
by: ndsoumah | last post by:
hello guys I'm trying to get access to variables I put in a session variable from another page and it fails... here's the exact situation main file page1.php
3
by: Jeff Smythe | last post by:
I simply want to execute some code once when a new session of my ASP.NET application is started (I'm not using session state for anything else - just writing some data to a database). I thought...
9
by: McGeeky | last post by:
Is there a way to get a user control to remember its state across pages? I have a standard page layout I use with a header and footer as user controls. Each page uses the same layout by means of...
7
by: Mr Newbie | last post by:
I have written a Custom Control Menu. Its fairly simple but it works well enough. In order to simplify things I decided to store the Menu1 custom control in Session. In the page load event below,...
10
by: Steve Cook | last post by:
Hi, I have an upload application written in PHP and Flash. The PHP page gets the file information via $_POST. Moreover, the user never actually visits the PHP page, rather Flash sends the...
3
by: CptDondo | last post by:
I am working on an embedded system. The entire configuration for the system is stored in an XML file, which is pretty long. It takes about 3 seconds to open the file using domxml_open_file. ...
6
by: Bhagya | last post by:
Hello, On the LogOut Page i have done Session.Abandon(); And on every Page, In the Page_Load Event i check if the session exists and only then display data. Now the problem is after i logout from...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.