[UPHPU] stuffing the session bird
bigdog at venticon.com
Sat Mar 5 00:18:28 MST 2005
On Fri, 2005-03-04 at 17:29 -0700, Mac Newbold wrote:
> > What are the pros and cons of each? Am I correct in assuming that the
> > file method require the file to be parsed for each page load?
> Yes. It has to read the session back in every time. However, don't forget
> about other caching your system does. It is highly unlikely that it will
> actually go back to the disk to get the file... it will still be cached by
> your OS in most cases. Depending on how many other things the computer has
> done between accesses, it's probably still in memory or even in the CPU
> cache possibly.
you can modify this by tweaking your kernel params and setting paging
> >At what point are you going to see a degradation in performance with
> >either method?
> The file method will usually degrade much more slowly, even though it may
> be slightly lower performing to start with.
make sure you have enough file pointers set up for apache. we ran into
an issue with open file pointers maxing out because we has this set
really low for the use apache was running under.
> The memory way will perform faster (how much, I don't know), but when you
> get near to exhausting the memory resources of your server, performance
> will drop off a very high cliff for everything running on the box. It's
> called thrashing, and it's what happens when all your memory is full, and
> it has to start swapping memory out to disk, reading swapped memory back
> in, and doing that back and forth every time it changes what it is doing
> or even what request it is processing. So before you switch to the memory
> method, I'd make very sure that (a) you need to eek out every last bit of
> performance, (b) it makes a significant improvement in your performance,
> and (c) you'll _never_ be short enough on available ram that it has to
> start swapping it out to disk.
> In almost every case I can think of, the file method is much safer, and is
> usually the right choice, thus it is the default, and most people don't
> bother to change it.
> One thing suggested that can be a happy medium between the two ways is to
> keep your sessions on a memory-backed file system, like /tmp is on some
> servers. A file system like that has a fixed size, so it can never grow
> enough to fill your memory so you start thrashing. However, you can run
> out of disk space for sessions, in which case I believe it starts garbage
> collecting them more agressively to make room. The contents of such a /tmp
> dir would never be stored on disk, so you're guaranteed to not have to dig
> any deeper than the ram to get your session back when the next request
> comes in.
also remember that there are many things that you can do to your disks
that allow for increased performance...like setting swap on outside of
your disks. also like dave mentioned there are specific filesystems that
can help out and file system tweaking as well.
the big thing to remember is that there are many tweaks that can be
performed on each option and are you willing to do those.
More information about the UPHPU