You don't mention what database you're using, but mySQL supports memory
based tables.  You can use this to insert your single page loads and then
have a job that periodically inserts in bulk.

Memory based tables:

Jerry Wilborn

On Fri, Aug 7, 2009 at 5:46 PM, Waynn Lue <> wrote:

> Hey PHPers,
> We've been doing sampled logging to the database in our application for
> awhile, and now I'm hoping eventually to blow that out to a larger scale.
> I'm worried about the performance implications of logging to our database
> on
> every single page load, though, so I was wondering if anyone's found a
> solution that does buffered logging.  Essentially it would log to memory
> (memcached/apc/etc), and then periodically dump to a database in a
> structured format, preferrably user-defined.  It's not essential that we
> get
> every signle hit, so I'd be fine if there was some data loss on a restart.
> I started writing my own solution, and then thought I'd ask the list to see
> if anyone has any experience with other tools that do this.
> My Google searches around "buffered logging" have mainly found error
> logging
> packages, like PEAR's Log package, or log4php.  Those all seem to write to
> only one particular stream at a time, with no real support for buffering it
> in memory and then moving it to database.
> Thanks for any help!
> Waynn

Reply via email to