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

PRIKOM, Privat Kursus Komputer di Cimincrang Gedebage Bandung

PRIKOM - Les Privat Komputer di wilayah sekitar Cimincrang Gedebage Bandung, Whatsapp  0812-8733-1966, PRIKOM menyediakan jasa Privat dan kursus komputer terbaik dan murah di bandung dengan topik unggulan  Word, Excel, Powerpoint, Access database, Excel Vba Macro, MS Project, Corel, Photoshop dan lainnya , Guru dapat dipanggil ke rumah Anda sekitar Gedebage dengan standard protokol kesehatan covid-19, atau bisa datang ke kantor PRIKOM , hubungi Admin PRIKOM 081287331966 (Whatsapp) atau visit https://privatkomputerbandung.wordpress.com , Jam operasional 09.00-21.00, privat komputer untuk seluruh wilayah bandung dan cimahi , Untuk level Pemula sampai dengan Level Mahir, Peserta akan didampingi tenaga pengajar (Pria/ Wanita) yang berpengalaman dan sabar dalam menyampaikan materi privat / kursus komputer #privatkomputerbandung #bandung #kursuskomputer #tutorialkomputer #komputerpemula #belajarkomputer #ilmukomputer #jakarta #bekasi  #Gedebage #Cimincrang Jasa Privat Komputer guru Ke rumah...

Teror di Paris, 10 tewas , 5 di sandra, foto pelaku teror

Aksi terorisme yang dilakukan terhadap kantor tabloid Charlie Hebdo di Paris yang berjarak sekitar 2 KM dari Menara Eiffel , aksi terorisme yang berlangsung pada tanggal 7 januari dan masih berlanjut telah menewaskan 10 wartawan termasuk pemimpin redaksi, 2 Polisi dan juga penyanderaan sekitar 5 orang di sebuah supermarket, aksi penyanderaan dikabarkan juga terjadi dilokasi lain. Cherif and Said Kouachi adalah dua bersaudara tersangka aksi teror di markas Charlie Hebdo. Pelaku lain adalah Mourad hamyd berusia 18 tahun dilaporkan telah menyerahkan Diri ke pihak polisi Cherif bukan nama yang asing lagi bagi polisi antiteror Prancis. Pria yang memiliki nama alias Abu Issen tersebut tercatat sebagai anggota Jaringan Buttes-Chaumont yang aktif mengirimkan pejihad ke Iraq. Saat itu dia memang merekrut muslim radikal dari Prancis untuk bergabung dengan Al Qaeda dan memerangi pasukan Amerika Serikat (AS) yang mereka anggap menginvasi Iraq. Cherif tertangkap saat hendak terbang ke Syria dalam p...

Jokowi

Jokowi Trending Topic KUMPULAN BERITA JOKOWI AHOK : Celetukan-celetukan Ahok untuk pendatang ... www.merdeka.com/tag/j/ jokowi -ahok Salinan Follow tag merdeka.com akan membantu untuk mendapatkan berita yang sesuai preferensi Anda. Misal Anda suka berita Jokowi Ahok, masukkan email dan Anda hanya akan ... quoted by www.sisindotek.com / www.sindonusa.com Joko Widodo - Wikipedia, the free encyclopedia en.wikipedia.org/wiki/Joko_Widodo Salinan Jokowi will serve as Governor of Jakarta until 20 October 2014, the official commencement date of his term as the 7th President of Indonesia. Contents. quoted by www.sisindotek.com / www.sindonusa.com merdeka.com: Halaman Tag www.merdeka.com/tag/j/ jokowi Salinan Follow tag merdeka.com akan membantu untuk mendapatkan berita yang sesuai preferensi Anda. Misal Anda suka berita Jokowi , masukkan email dan Anda hanya akan ...quoted by www.sisindotek.com / www.sindonusa.com Jokowi www. jokowi .id Salinan Jokowi Bertemu Relawan Di Rumah Tra...