in reply to OO Perl & RDBMS Strategy Question

I've not used DB's from Perl yet and am not familiar with the modules available, but if I was setting out to write something I think I would (probably) opt for something that used the *nix fork strategy? By which I mean:

When an object is created, it issues a select for the whole table (or possible several smaller chunks and accumulates) so that it has its data available for immediate read access. Then, when a record (or records if that makes sense) is updated, it writes back to the DB. Of course, this assumes that only this object ever has write access to that part of the DB.

If that scenario is true, but the updates are sufficiently large to mean that updates cause an unacceptable delay to the front end, then the updates could be queued to an update 'deamon' process. Something like the 'lazy-writeback' used on disk drives? This is not-trivial to get right, and is vunerable to power failures etc. If the DBM supports transactions, some of that can be mitigated, especially if the transactions to the DB were queued via disk, or probably better, in parrellel to disc and removed from disc once the transaction is confirmed.

Effectively, this is just re-inventing the well-known 3-tier model.


Well It's better than the Abottoire, but Yorkshire!Perl hacker's do it with less strokes!

Replies are listed 'Best First'.
Re: Re: OO Perl & RDBMS Strategy Question
by Stegalex (Chaplain) on Aug 30, 2002 at 13:25 UTC
    I hope I am not taking the following quote out of context:

    When an object is created, it issues a select for the whole table (or possible several smaller chunks and accumulates) so that it has its data available for immediate read access

    Selecting an entire table into memory becomes a real problem when you're dealing with large tables. Also, selecting the table into memory does not lock it. One important thing to remember about some databases (Oracle for one) is that the DB makes every effort to keep frequently accessed blocks of data in memory so that you don't have to do a physical read/write when doing selects, inserts, updates, deletes. This explains (in part) why Oracle soaks up so much memory and CPU.

    ~~~~~~~~~~~~~~~
    I like chicken.