Skip to main content

Magento Session Data choose (file system or database )

Filesystem Session storage

Remember that innocuous setting during Magento install that asks you if you want to store your sessions on disk or in the database? Well if you are like me, you normally choose filesystem, not knowing any better and having never bothered to test or research the consequences (until now)

The benefits of file-based sessions for Magento are simplicity, stability and durability. It's simple because you don't have to do anything to set it up. It's stable because most modern filesystems use journaling to make sure that in the event of a system crash your session data is consistent. It's also durable, because a system restart will not cause you to lose your session data. Coming back to a webstore a week later and not having your items in your cart is annoying, right?

To enable file-based storage, choose it during installation or in your app/etc/local.xml file simply make sure you have a session_save tag like this:

1
<session_save><![CDATA[files]]></session_save>

Note: Look in app/etc/local.xml.additional for examples but ignore the comment about empty defaulting to files, you need the word files in there.

I have performance benchmarked filesystem storage in the Benchmark section below.

Database Session storage

Database session storage is the other storage type, the one you probably didn't choose during install, and forgot to circle back round and find out if you should have. With database session storage the session data is stored in the Magento MySQL database. The connection used is the same as the core connection.

One of the key benefits of using database sessions is the clustered environment support. In a filesystem based session storage scheme, if you have more than one Magento frontend node in a cluster, they will need to share session data (unless you use a loadbalancer with sticky sessions) and the database gives you that capability quite easily.

Databases also have good stability and durability during crashes and reboots.

One of the problems with database session storage is that it adds more load to the database. On large catalog sites with many SKUs, or busy sites with lots of sessions, this can hurt the database performance.

To use the database for session storage simply have this in your local.xml:

1
<session_save><![CDATA[db]]></session_save>

Check out the benchmarks below to see how well database session storage performs.





Regards,

 
 HERY PURNAMA
 
MCDBA, ITILF, PMP, CISA
 IT & Management Trainer

 http://www.inhousetrainer.net
 inhousetrainer@yahoo.com , hery.purnama@gmail.com
 Call/ SMS/WA :  081.223344.506 | PinBB : 7DC633AA
 
 Blog :
 inhousetrainer.blogspot.com
 freelance-it-trainer.blogspot.com
 
 Social Net :
 facebook.com/inhousetrainer
 twitter.com/inhousetrainer
 instagram.com/inhousetrainer
 
 

Comments

Popular posts from this blog

salingsapa.com , sekalipun pakai script open source JCOW tapi salut buat de Yahya

Mungkin semua sudah mulai mengenal salingsapa.com , bukan karena isi webnya saja tapi pemiliknya adalah seorang anak SMP yaitu de yahya. Beberapa komentar muncul di internet soal keberadaan web ini, baik yang positif atau negatif. Memang benar bahwa salingsapa.com bukanlah tailormade website, atau website yang dibangun dengan kemampuan skill programming si pemiliknya, salingsapa.com menggunakan script JCOW.com. Tapi kita ambil positifnya, lihatlah dari sisi kecerdasan si anak yang bisa melihat potensi pasar di internet, yang bisa berinisiatif membuat sebuah website yang bisa mendatangkan orang , yang tahu apa yang dibutuhkan publik ? sesuatu yang tidak dimiliki anak - anak SMP kita saat ini yang cenderung hanya menjadi penonton dan user saja Petron yakin dalam 2 -5 tahun lagi de Yahya akan benar benar membuat web social buatannya dia sendiri. Biasakanlah memberi dukungan yang positif kepada generasi dibawah kita untuk hal hal yang mengarah kepada perkembangan yang positif juga. Dan med...

Cara Akses Tol Bandung ke PRJ Kemayoran Jakarta , Jakartafair ? lewat tol ancol ?

Gw kira paman google sudah menyediakan segalanya... mmhhh ternyata belum.khususnya saat gw nyari jalur tol dari bandung menuju PRJ Kemayoran jakarta yang lagi diselenggarakan 2010 ini, mmhhh sepertinya i'm in trouble :) . Ok gini ceritanya balik kejakarta dari bandung ternyata ada tugas mulia menanti, rencananya mertua , adik ipar dan pasukan kecil (anak gw dan ponakan) bakal berangkat main ke jakarta hari sabtu , targetnya ? PRJ and Grand Indonesia, grand indonesia sih gak masalah.. nah PRJ ini yang jadi masalah.. maklum seumur umur cuma denger aja kehebohan PRJ ini tapi nengok kesana gw belum pernah bahkan setelah 1 tahun lebih dijakarta akses menuju kesana saja bener bener gak tau, perasaan sih dulu pernah di tunjukin supir kantor waktu gw mau ke mangga dua, tapi ya ilahhh... mana kepikiran dulu bakal ada tugas ini sekarang... :D gw coba nyari di google.. dengan mengetikan semua yang terkait akses tol dari bandung ke PRJ ini .. hasilnya gak ada,.. mungkin ada petunjuk kecil yang...

TRAINING SQL Server 2017 DATABASE ADMINISTRATOR-BANDUNG

TRAINING SQL Server 2017 DATABASE ADMINISTRATOR By Purnama Academy - Training Center January 18, 2018  No comments SQL Server 2017 DATABASE ADMINISTRATOR Syllabus Class Type           : Training Duration              : 4 Days (09.00 – 17.00) Training Description : Microsoft SQL Server is a relational database management system developed by Microsoft. As a database server, it is a software product with the primary function of storing and retrieving data as requested by other software applications—which may run either on the same computer or on another computer across a network Database administrators (DBAs) use specialized software to store and organize data. The role may include capacity planning, installation, configuration, database design, migration, performance monitoring, security, troubleshooting, as well as backup and data recovery Call us for detail syllabus ! ...