PostgreSQL has one real behavior problem. Updates act as if you do a
delete then an insert, i.e. for transactional isolation, an updated row
is added new, and the old one is marked as deleted. Sessions are all
about updates, and any really active server cluster will expose
PostgreSQL's worst behavior.
I agree. It will slows down thing a *LOT*.
But it's faster than files save handler with proper
administration, I suppose.
I actually doubt it it will be. An insert into a database like PostgreSQL has a lot more overhead than just the basic file manipulation.
Both I and you could be wrong :)
File system like Ext2, uses liner search for dir entry and dir
operation is atomic in OS. This is a lot of overheads.
However, newer FS like ReiserFS/XFS/Ext3 uses Btree for dir
entry that helps a lot.
PostgreSQL is using MVCC. Therefore, it could be faster for
many session data. It also can share session data with multiple
web servers.
Anyone care to take benchmarks?
(You need to wait a little more, since session module needed
to be changed to work with pgsql session save handler)
I got a little time to take some simple benchmarks
using ApacheBench 1.3d.
OS: Linux 2.4.4/glibc 2.2.2
PC: Intel Celeron 433Mhz/384MB RAM/ATA33 EIDE HDD
PostgreSQL: 7.1.3 installed on the same PC
Filesystem: ReiserFS
PHP: Debug enabled 4.2.0-dev/Apache SAPI
There are 5000 session data stored already. Addtional
5000 session data is created by "ab -n 5000 <URL>"
Files handler:
Requests per second: 95.44 [#/sec] (mean)
Pgsql handler:
Requests per second: 68.98 [#/sec] (mean)
If btree is used for index, PostreSQL slows down a lot.
I used hash for index. Most of CPU time is used
by PostgreSQL during benchmark. If PostgreSQL server
is installed in other PC, pgsql result may be close to
files handler. Ext2 FS users may get slower
performance with files handler. (Or faster for 10K
sessions?)
--
Yasuo Ohgaki
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com