[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Webserver Redundacy

On Wed, Feb 28, 2007 at 04:55:28PM +0000, Andy wrote:
> Craig Sanders wrote:
> >the easiest ways to do this is with a shared or network filesystem
> >(be careful of file locking), or in a database (let the db handle
> >locking issues).
> We are looking an an LVS system as discussed in this thread, with a
> centralised file-system exported over NFS.
> Our sessions are all PHP sessions from /var/lib/php4. If we just NFS
> export this are we going to have horrible locking problems?

it depends on how well written your code is :-)

also, i haven't worked extensively with NFS for several years now, but
it has ALWAYS had a terrible reputation for locking issues. there are
particular ways of doing NFS-safe locking (see, for example the way that
mail servers like postfix do it), and many ways of doing unsafe locking.

> Any suggestions?

my recommendation would be to avoid locking issues entirely and use
either a database or, if you dont want to install postgresql or mysql or
whatever, use memcached and store your session data in the shared memory

memached is packaged for debian.

# apt-cache show memcached php4-memcache

Package: memcached
Priority: optional
Section: web
Installed-Size: 156
Maintainer: Jay Bonci <jaybonci@debian.org>
Architecture: i386
Version: 1.1.12-1
Depends: libc6 (>= 2.3.2.ds1-4), libevent1 (>= 1.0b), perl
Suggests: libcache-memcached-perl
Filename: pool/main/m/memcached/memcached_1.1.12-1_i386.deb
Size: 33046
MD5sum: 095b820ca7b851eba3d4cc5fda9e7453
SHA1: a6798f7639a66ea19d7b88d597a60241245e8ecc
SHA256: 448117e3cda79ca1046d5c6e7553f66c95c8dc92668e0bf21f72b063ccecc6f8
Description: A high-performance memory object caching system
 Danga Interactive developed memcached to enhance the speed of LiveJournal.com,
 a site which was already doing 20 million+ dynamic page views per day for 1
 million users with a bunch of webservers and a bunch of database servers.
 memcached dropped the database load to almost nothing, yielding faster page
 load times for users, better resource utilization, and faster access to the
 databases on a memcache miss.
 memcached optimizes specific high-load serving applications that are designed
 to take advantage of its versatile no-locking memory access system. Clients
 are available in several different programming languages, to suit the needs
 of the specific application. Traditionally this has been used in mod_perl
 apps to avoid storing large chunks of data in Apache memory, and to share
 this burden across several machines.
Tag: devel::profiler, interface::daemon, network::server, role::program, special::not-yet-tagged, special::not-yet-tagged::m

Package: php4-memcache
Priority: optional
Section: web
Installed-Size: 68
Maintainer: Pierre Habouzit <madcoder@debian.org>
Architecture: i386
Source: php-memcache
Version: 2.0.1-1.1
Depends: debconf (>= 0.5) | debconf-2.0, phpapi-20050606+lfs, php4-common
Filename: pool/main/p/php-memcache/php4-memcache_2.0.1-1.1_i386.deb
Size: 18460
MD5sum: 2832c776183925876a2c42f9542ec88d
SHA1: 9c98c562b421d0bc285a79cfc3bd112ea23feb13
SHA256: 5cc3e284933efb08a5b3be5bffc6a419ca83a64d7dae52a465155a1493918a72
Description: memcache extension module for PHP4
 Memcached is a caching daemon designed especially for dynamic web applications
 to decrease database load by storing objects in memory.
 This extension allows you to work with memcached through handy OO and
 procedural interfaces in your php4 applications.
 documentation on: http://fr.php.net/memcache/

> PS) I also have similar questions about maildir over NFS.

maildir isn't too bad, it avoids most locking issues by having one file
per message....and most maildir capable programs are well aware of NFS
locking issues.


craig sanders <cas@taz.net.au>

Currently listening to: Chris Organic - The Shaman

Why does man kill?  He kills for food.  And not only food: frequently
there must be a beverage.
		-- Woody Allen, "Without Feathers"

Reply to: