home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-perl-addon-1.4.9-installer.exe / Sync.pm < prev    next >
Encoding:
Perl POD Document  |  2002-07-03  |  18.5 KB  |  590 lines

  1.  
  2. package MLDBM::Sync;
  3. $VERSION = '0.30';
  4.  
  5. use MLDBM;
  6. use MLDBM::Sync::SDBM_File;
  7. use Data::Dumper;
  8. use Fcntl qw(:flock);
  9. use Digest::MD5 qw(md5_hex);
  10. use strict;
  11. use Carp qw(confess);
  12. no strict qw(refs);
  13. use vars qw($AUTOLOAD @EXT $CACHE_ERR $LOCK_SH $LOCK_EX $LOCK_UN);
  14.  
  15. eval "use Tie::Cache;";
  16. if (($@)) {
  17.     $CACHE_ERR = $@;
  18. }
  19.  
  20. $LOCK_SH = LOCK_SH;
  21. $LOCK_UN = LOCK_UN;
  22. $LOCK_EX = LOCK_EX;
  23.  
  24. @EXT = ('.pag', '.dir', '');
  25.  
  26. sub TIEHASH {
  27.     my($class, $file, @args) = @_;
  28.  
  29.     $file =~ /^(.*)$/s;
  30.     $file = $1;
  31.     my $fh = $file.".lock";
  32.  
  33.     my $self = bless {
  34.               'file' => $file,
  35.               'args' => [ $file, @args ],
  36.               'lock_fh' => $fh,
  37.               'lock_file' => $fh,
  38.               'lock_num' => 0,
  39.               'md5_keys' => 0,
  40.               'pid' => $$,
  41.               'keys' => [],
  42.               'db_type' => $MLDBM::UseDB,
  43.               'serializer' => $MLDBM::Serializer,
  44.               'remove_taint' => $MLDBM::RemoveTaint,
  45.              };
  46.  
  47.     $self;
  48. }
  49.  
  50. sub DESTROY { 
  51.     my $self = shift;
  52.     if($self->{lock_num}) {
  53.     $self->{lock_num} = 1;
  54.     $self->UnLock;
  55.     }
  56. }
  57.  
  58. sub AUTOLOAD {
  59.     my($self, $key, $value) = @_;
  60.     $AUTOLOAD =~ /::([^:]+)$/;
  61.     my $func = $1;
  62.     grep($func eq $_, ('FETCH', 'STORE', 'EXISTS', 'DELETE'))
  63.       || die("$func not handled by object $self");
  64.  
  65.     ## CHECKSUM KEYS
  66.     if(defined $key && $self->{md5_keys}) {
  67.     $key = $self->SyncChecksum($key);
  68.     }
  69.  
  70.     # CACHE, short circuit if found in cache on FETCH/EXISTS
  71.     # after checksum, since that's what we store
  72.     my $cache = (defined $key) ? $self->{cache} : undef;
  73.     if($cache && ($func eq 'FETCH' or $func eq 'EXISTS')) {
  74.     my $rv = $cache->$func($key);
  75.     defined($rv) && return($rv);
  76.     }
  77.  
  78.     my $rv;
  79.     if ($func eq 'FETCH' or $func eq 'EXISTS') {
  80.     $self->read_lock;
  81.     } else {
  82.     $self->lock;
  83.     }
  84.  
  85.     {
  86.     local $MLDBM::RemoveTaint = $self->{remove_taint};
  87.     if (defined $value) {
  88.         $rv = $self->{dbm}->$func($key, $value);
  89.     } else {
  90.         $rv = $self->{dbm}->$func($key);
  91.     }
  92.     }
  93.  
  94.     $self->unlock;
  95.  
  96.     # do after lock critical section, no point taking 
  97.     # any extra time there
  98.     $cache && $cache->$func($key, $value);
  99.  
  100.     $rv;
  101. }
  102.  
  103. sub CLEAR { 
  104.     my $self = shift;
  105.     
  106.     $self->lock;
  107.     $self->{dbm}->CLEAR;
  108.     $self->{dbm} = undef;
  109.     # delete the files to free disk space
  110.     my $unlinked = 0;
  111.     for (@EXT) {
  112.     my $file = $self->{file}.$_;    
  113.     next if(! -e $file);
  114.     if(-d $file) {
  115.         rmdir($file) || warn("can't unlink dir $file: $!");
  116.     } else {
  117.         unlink($file) || die("can't unlink file $file: $!");
  118.     }
  119.  
  120.     $unlinked++;
  121.     }
  122.     if($self->{lock_num} > 1) {
  123.     $self->SyncTie; # recreate, not done with it yet
  124.     }
  125.  
  126.     $self->unlock;
  127.     if($self->{lock_num} == 0) {
  128.     # only unlink if we are clear of all the locks
  129.     unlink($self->{lock_file});
  130.     }
  131.     
  132.     $self->{cache} && $self->{cache}->CLEAR;
  133.  
  134.     1;
  135. };
  136.  
  137. # don't bother with cache for first/next key since it'll kill
  138. # the cache anyway likely
  139. sub FIRSTKEY {
  140.     my $self = shift;
  141.  
  142.     if($self->{md5_keys}) {
  143.     confess("can't get keys() or each() on MLDBM::Sync database ".
  144.         "with SyncKeysChecksum(1) set");
  145.     }
  146.     
  147.     $self->read_lock;
  148.     my $key = $self->{dbm}->FIRSTKEY();
  149.     my @keys;
  150.     while(1) {
  151.     last if ! defined($key);
  152.     push(@keys, $key);
  153.     $key = $self->{dbm}->NEXTKEY($key);
  154.     }
  155.     $self->unlock;
  156.     $self->{'keys'} = \@keys;
  157.  
  158.     $self->NEXTKEY;
  159. }
  160.  
  161. sub NEXTKEY {
  162.     my $self = shift;
  163.  
  164.     if($self->{md5_keys}) {
  165.     confess("can't get keys() or each() on MLDBM::Sync database ".
  166.         "with SyncKeysChecksum(1) set");
  167.     }
  168.     
  169.     my $rv = shift(@{$self->{'keys'}});
  170. }
  171.  
  172. sub SyncChecksum {
  173.     my($self, $key) = @_;
  174.     if(ref $key) {
  175.     join('g', md5_hex($$key), sprintf("%07d",length($$key)));
  176.     } else {
  177.     join('g', md5_hex($key), sprintf("%07d", length($key)));
  178.     }
  179. }
  180.  
  181. sub SyncCacheSize {
  182.     my($self, $size) = @_;
  183.     $CACHE_ERR && die("need Tie::Cache installed to use this feature: $@");
  184.  
  185.     if ($size =~ /^(\d+)(M|K)$/) {
  186.     my($num, $type) = ($1, $2);
  187.     if (($type eq 'M')) {
  188.         $size = $num * 1024 * 1024;
  189.     } elsif (($type eq 'K')) {
  190.         $size = $num * 1024;
  191.     } else {
  192.         die "$type symbol not understood for $size";
  193.     }
  194.     } else {
  195.     ($size =~ /^\d+$/) or die("$size must be bytes size for cache");
  196.     }
  197.     
  198.     if ($self->{cache}) {
  199.     $self->{cache}->CLEAR(); # purge old cache, to free up RAM maybe for mem leaks
  200.     }
  201.     
  202.     my %cache;
  203.     my $cache = tie %cache, 'Tie::Cache', { MaxBytes => $size };
  204.     $self->{cache} = $cache; # use non tied interface, faster
  205. }
  206.  
  207. sub SyncTie {
  208.     my $self = shift;
  209.     my %temp_hash;
  210.     my $args = $self->{args};
  211.     local $MLDBM::UseDB = $self->{db_type};
  212.     local $MLDBM::Serializer = $self->{serializer};
  213.     local $MLDBM::RemoveTaint = $self->{remove_taint};
  214.     $self->{dbm} = tie(%temp_hash, 'MLDBM', @$args) || die("can't tie to MLDBM with args: ".join(',', @$args)."; error: $!");
  215.  
  216.     $self->{dbm};
  217. }
  218.  
  219. #### DOCUMENTED API ################################################################
  220.  
  221. sub SyncKeysChecksum {
  222.     my($self, $setting) = @_;
  223.     if(defined $setting) {
  224.     $self->{md5_keys} = $setting;
  225.     } else {
  226.     $self->{md5_keys};
  227.     }
  228. }
  229.  
  230. *read_lock = *ReadLock;
  231. sub ReadLock { shift->Lock(1); }
  232.  
  233. *lock = *SyncLock = *Lock;
  234. sub Lock {
  235.     my($self, $read_lock) = @_;
  236.  
  237.     if($self->{lock_num}++ == 0) {
  238.     my $file = $self->{lock_file};
  239.     open($self->{lock_fh}, "+>$file") || die("can't open file $file: $!");
  240.     flock($self->{lock_fh}, ($read_lock ? $LOCK_SH : $LOCK_EX))
  241.       || die("can't ". ($read_lock ? "read" : "write") ." lock $file: $!");
  242.     $self->{read_lock} = $read_lock;
  243.     $self->SyncTie;
  244.     } else {
  245.     if ($self->{read_lock} and ! $read_lock) {
  246.         $self->{lock_num}--; # roll back lock count
  247.         # confess here to help developer track this down
  248.         confess("Can't upgrade lock type from LOCK_SH to LOCK_EX! ".
  249.             "This could happen if you tried to write to the MLDBM ".
  250.             "in a critical section locked by ReadLock(). ".
  251.             "Also the read expression my \$v = \$db{'key1'}{'key2'} will trigger a write ".
  252.             "if \$db{'key1'} does not already exist, so this will error in a ReadLock() section"
  253.             );
  254.     }
  255.     1;
  256.     }
  257. }
  258.  
  259. *unlock = *SyncUnLock = *UnLock;
  260. sub UnLock {
  261.     my $self = shift;
  262.  
  263.     if($self->{lock_num} && $self->{lock_num}-- == 1) {
  264.     $self->{lock_num} = 0;
  265.     undef $self->{dbm};
  266.     flock($self->{'lock_fh'}, $LOCK_UN) || die("can't unlock $self->{'lock_file'}: $!");
  267.     close($self->{'lock_fh'}) || die("can't close $self->{'lock_file'}");
  268.     $self->{read_lock} = undef;
  269.     1;
  270.     } else {
  271.     1;
  272.     }
  273. }
  274.  
  275. sub SyncSize {
  276.     my $self = shift;
  277.     my $size = 0;
  278.     for (@EXT) {
  279.     my $file = $self->{file}.$_;    
  280.     next unless -e $file;
  281.     $size += (stat($file))[7];
  282.  
  283.     if(-d $file) {
  284.         $size += (stat($file))[7];
  285.         opendir(DIR, $file) || next;
  286.         my @files = readdir(DIR);
  287.         for my $dir_file (@files) {
  288.         next if $dir_file =~ /^\.\.?$/;
  289.         $size += (stat("$file/$dir_file"))[7];
  290.         }
  291.         closedir(DIR);
  292.     }
  293.     }
  294.  
  295.     $size;
  296. }
  297.  
  298. 1;
  299.  
  300. __END__
  301.  
  302. =head1 NAME
  303.  
  304.   MLDBM::Sync - safe concurrent access to MLDBM databases
  305.  
  306. =head1 SYNOPSIS
  307.  
  308.   use MLDBM::Sync;                       # this gets the default, SDBM_File
  309.   use MLDBM qw(DB_File Storable);        # use Storable for serializing
  310.   use MLDBM qw(MLDBM::Sync::SDBM_File);  # use extended SDBM_File, handles values > 1024 bytes
  311.   use Fcntl qw(:DEFAULT);                # import symbols O_CREAT & O_RDWR for use with DBMs
  312.  
  313.   # NORMAL PROTECTED read/write with implicit locks per i/o request
  314.   my $sync_dbm_obj = tie %cache, 'MLDBM::Sync' [..other DBM args..] or die $!;
  315.   $cache{"AAAA"} = "BBBB";
  316.   my $value = $cache{"AAAA"};
  317.  
  318.   # SERIALIZED PROTECTED read/write with explicit lock for both i/o requests
  319.   my $sync_dbm_obj = tie %cache, 'MLDBM::Sync', '/tmp/syncdbm', O_CREAT|O_RDWR, 0640;
  320.   $sync_dbm_obj->Lock;
  321.   $cache{"AAAA"} = "BBBB";
  322.   my $value = $cache{"AAAA"};
  323.   $sync_dbm_obj->UnLock;
  324.  
  325.   # SERIALIZED PROTECTED READ access with explicit read lock for both reads
  326.   $sync_dbm_obj->ReadLock;
  327.   my @keys = keys %cache;
  328.   my $value = $cache{'AAAA'};
  329.   $sync_dbm_obj->UnLock;
  330.  
  331.   # MEMORY CACHE LAYER with Tie::Cache
  332.   $sync_dbm_obj->SyncCacheSize('100K');
  333.  
  334.   # KEY CHECKSUMS, for lookups on MD5 checksums on large keys
  335.   my $sync_dbm_obj = tie %cache, 'MLDBM::Sync', '/tmp/syncdbm', O_CREAT|O_RDWR, 0640;
  336.   $sync_dbm_obj->SyncKeysChecksum(1);
  337.   my $large_key = "KEY" x 10000;
  338.   $sync{$large_key} = "LARGE";
  339.   my $value = $sync{$large_key};
  340.  
  341. =head1 DESCRIPTION
  342.  
  343. This module wraps around the MLDBM interface, by handling concurrent
  344. access to MLDBM databases with file locking, and flushes i/o explicity
  345. per lock/unlock.  The new [Read]Lock()/UnLock() API can be used to serialize
  346. requests logically and improve performance for bundled reads & writes.
  347.  
  348.   my $sync_dbm_obj = tie %cache, 'MLDBM::Sync', '/tmp/syncdbm', O_CREAT|O_RDWR, 0640;
  349.  
  350.   # Write locked critical section
  351.   $sync_dbm_obj->Lock;
  352.     ... all accesses to DBM LOCK_EX protected, and go to same tied file handles
  353.     $cache{'KEY'} = 'VALUE';
  354.   $sync_dbm_obj->UnLock;
  355.  
  356.   # Read locked critical section
  357.   $sync_dbm_obj->ReadLock;
  358.     ... all read accesses to DBM LOCK_SH protected, and go to same tied files
  359.     ... WARNING, cannot write to DBM in ReadLock() section, will die()
  360.     ... WARNING, my $v = $cache{'KEY'}{'SUBKEY'} will trigger a write so not safe
  361.     ...   to use in ReadLock() section
  362.     my $value = $cache{'KEY'};
  363.   $sync_dbm_obj->UnLock;
  364.  
  365.   # Normal access OK too, without explicity locking
  366.   $cache{'KEY'} = 'VALUE';
  367.   my $value = $cache{'KEY'};
  368.  
  369. MLDBM continues to serve as the underlying OO layer that
  370. serializes complex data structures to be stored in the databases.
  371. See the MLDBM L<BUGS> section for important limitations.
  372.  
  373. MLDBM::Sync also provides built in RAM caching with Tie::Cache
  374. md5 key checksum functionality.
  375.  
  376. =head1 INSTALL
  377.  
  378. Like any other CPAN module, either use CPAN.pm, or perl -MCPAN C<-e> shell,
  379. or get the file MLDBM-Sync-x.xx.tar.gz, unzip, untar and:
  380.  
  381.   perl Makefile.PL
  382.   make
  383.   make test
  384.   make install
  385.  
  386. =head1 LOCKING
  387.  
  388. The MLDBM::Sync wrapper protects MLDBM databases by locking
  389. and unlocking around read and write requests to the databases.
  390. Also necessary is for each new lock to tie() to the database
  391. internally, untie()ing when unlocking.  This flushes any
  392. i/o for the dbm to the operating system, and allows for
  393. concurrent read/write access to the databases.
  394.  
  395. Without any extra effort from the developer, an existing 
  396. MLDBM database will benefit from MLDBM::sync.
  397.  
  398.   my $dbm_obj = tie %dbm, ...;
  399.   $dbm{"key"} = "value";
  400.  
  401. As a write or STORE operation, the above will automatically
  402. cause the following:
  403.  
  404.   $dbm_obj->Lock; # also ties
  405.   $dbm{"key"} = "value";
  406.   $dbm_obj->UnLock; # also unties
  407.  
  408. Just so, a read or FETCH operation like:
  409.  
  410.   my $value = $dbm{"key"};
  411.  
  412. will really trigger:
  413.  
  414.   $dbm_obj->ReadLock; # also ties
  415.   my $value = $dbm{"key"};
  416.   $dbm_obj->Lock; # also unties
  417.  
  418. However, these lock operations are expensive because of the 
  419. underlying tie()/untie() that occurs for i/o flushing, so 
  420. when bundling reads & writes, a developer may explicitly
  421. use this API for greater performance:
  422.  
  423.   # tie once to database, write 100 times
  424.   $dbm_obj->Lock;
  425.   for (1..100) {
  426.     $dbm{$_} = $_ * 100;
  427.     ...
  428.   }
  429.   $dbm_obj->UnLock;
  430.  
  431.   # only tie once to database, and read 100 times
  432.   $dbm_obj->ReadLock;
  433.   for(1..100) {
  434.     my $value = $dbm{$_};  
  435.     ...
  436.   }
  437.   $dbm_obj->UnLock;
  438.  
  439. =head1 CACHING
  440.  
  441. I built MLDBM::Sync to serve as a fast and robust caching layer
  442. for use in multi-process environments like mod_perl.  In order
  443. to provide an additional speed boost when caching static data,
  444. I have added an RAM caching layer with Tie::Cache, which 
  445. regulates the size of the memory used with its MaxBytes setting.
  446.  
  447. To activate this caching, just:
  448.  
  449.   my $dbm = tie %cache, 'MLDBM::Sync', '/tmp/syncdbm', O_CREAT|O_RDWR, 0640;
  450.   $dbm->SyncCacheSize(100000);  # 100000 bytes max memory used
  451.   $dbm->SyncCacheSize('100K');  # 100 Kbytes max memory used
  452.   $dbm->SyncCacheSize('1M');    # 1 Megabyte max memory used
  453.  
  454. The ./bench/bench_sync.pl, run like "bench_sync.pl C<-c>" will run 
  455. the tests with caching turned on creating a benchmark with 50%
  456. cache hits.
  457.  
  458. One run without caching was:
  459.  
  460.  === INSERT OF 50 BYTE RECORDS ===
  461.   Time for 100 writes + 100 reads for  SDBM_File                  0.16 seconds     12288 bytes
  462.   Time for 100 writes + 100 reads for  MLDBM::Sync::SDBM_File     0.17 seconds     12288 bytes
  463.   Time for 100 writes + 100 reads for  GDBM_File                  3.37 seconds     17980 bytes
  464.   Time for 100 writes + 100 reads for  DB_File                    4.45 seconds     20480 bytes
  465.  
  466. And with caching, with 50% cache hits:
  467.  
  468.  === INSERT OF 50 BYTE RECORDS ===
  469.   Time for 100 writes + 100 reads for  SDBM_File                  0.11 seconds     12288 bytes
  470.   Time for 100 writes + 100 reads for  MLDBM::Sync::SDBM_File     0.11 seconds     12288 bytes
  471.   Time for 100 writes + 100 reads for  GDBM_File                  2.49 seconds     17980 bytes
  472.   Time for 100 writes + 100 reads for  DB_File                    2.55 seconds     20480 bytes
  473.  
  474. Even for SDBM_File, this speedup is near 33%.
  475.  
  476. =head1 KEYS CHECKSUM
  477.  
  478. A common operation on database lookups is checksumming
  479. the key, prior to the lookup, because the key could be
  480. very large, and all one really wants is the data it maps
  481. too.  To enable this functionality automatically with 
  482. MLDBM::Sync, just:
  483.  
  484.   my $sync_dbm_obj = tie %cache, 'MLDBM::Sync', '/tmp/syncdbm', O_CREAT|O_RDWR, 0640;
  485.   $sync_dbm_obj->SyncKeysChecksum(1);
  486.  
  487.  !! WARNING: keys() & each() do not work on these databases
  488.  !! as of v.03, so the developer will not be fooled into thinking
  489.  !! the stored key values are meaningful to the calling application 
  490.  !! and will die() if called.
  491.  !!
  492.  !! This behavior could be relaxed in the future.
  493.  
  494. An example of this might be to cache a XSLT conversion,
  495. which are typically very expensive.  You have the 
  496. XML data and the XSLT data, so all you do is:
  497.  
  498.   # $xml_data, $xsl_data are strings
  499.   my $xslt_output;
  500.   unless ($xslt_output = $cache{$xml_data.'&&&&'.$xsl_data}) {
  501.     ... do XSLT conversion here for $xslt_output ...
  502.     $cache{$xml_data.'&&&&'.xsl_data} = $xslt_output;
  503.   }
  504.  
  505. What you save by doing this is having to create HUGE keys
  506. to lookup on, which no DBM is likely to do efficiently.
  507. This is the same method that File::Cache uses internally to 
  508. hash its file lookups in its directories.
  509.  
  510. =head1 New MLDBM::Sync::SDBM_File
  511.  
  512. SDBM_File, the default used for MLDBM and therefore MLDBM::Sync 
  513. has a limit of 1024 bytes for the size of a record.
  514.  
  515. SDBM_File is also an order of magnitude faster for small records
  516. to use with MLDBM::Sync, than DB_File or GDBM_File, because the
  517. tie()/untie() to the dbm is much faster.  Therefore,
  518. bundled with MLDBM::Sync release is a MLDBM::Sync::SDBM_File
  519. layer which works around this 1024 byte limit.  To use, just:
  520.  
  521.   use MLDBM qw(MLDBM::Sync::SDBM_File);
  522.  
  523. It works by breaking up up the STORE() values into small 128 
  524. byte segments, and spreading those segments across many records,
  525. creating a virtual record layer.  It also uses Compress::Zlib
  526. to compress STORED data, reducing the number of these 128 byte 
  527. records. In benchmarks, 128 byte record segments seemed to be a
  528. sweet spot for space/time efficiency, as SDBM_File created
  529. very bloated *.pag files for 128+ byte records.
  530.  
  531. =head1 BENCHMARKS
  532.  
  533. In the distribution ./bench directory is a bench_sync.pl script
  534. that can benchmark using the various DBMs with MLDBM::Sync.
  535.  
  536. The MLDBM::Sync::SDBM_File DBM is special because is uses 
  537. SDBM_File for fast small inserts, but slows down linearly
  538. with the size of the data being inserted and read.
  539.  
  540. The results for a dual PIII-450 linux 2.4.7, with a ext3 file system 
  541. blocksize 4096 mounted async on a RAID-1 2xIDE 7200 RPM disk were as follows:
  542.  
  543.  === INSERT OF 50 BYTE RECORDS ===
  544.   Time for 100 writes + 100 reads for  SDBM_File                  0.16 seconds     12288 bytes
  545.   Time for 100 writes + 100 reads for  MLDBM::Sync::SDBM_File     0.19 seconds     12288 bytes
  546.   Time for 100 writes + 100 reads for  GDBM_File                  1.09 seconds     18066 bytes
  547.   Time for 100 writes + 100 reads for  DB_File                    0.67 seconds     12288 bytes
  548.   Time for 100 writes + 100 reads for  Tie::TextDir .04           0.31 seconds     13192 bytes
  549.  
  550.  === INSERT OF 500 BYTE RECORDS ===
  551.  (skipping test for SDBM_File 100 byte limit)
  552.   Time for 100 writes + 100 reads for  MLDBM::Sync::SDBM_File     0.52 seconds    110592 bytes
  553.   Time for 100 writes + 100 reads for  GDBM_File                  1.20 seconds     63472 bytes
  554.   Time for 100 writes + 100 reads for  DB_File                    0.66 seconds     86016 bytes
  555.   Time for 100 writes + 100 reads for  Tie::TextDir .04           0.32 seconds     58192 bytes
  556.  
  557.  === INSERT OF 5000 BYTE RECORDS ===
  558.  (skipping test for SDBM_File 100 byte limit)
  559.   Time for 100 writes + 100 reads for  MLDBM::Sync::SDBM_File     1.41 seconds   1163264 bytes
  560.   Time for 100 writes + 100 reads for  GDBM_File                  1.38 seconds    832400 bytes
  561.   Time for 100 writes + 100 reads for  DB_File                    1.21 seconds    831488 bytes
  562.   Time for 100 writes + 100 reads for  Tie::TextDir .04           0.58 seconds    508192 bytes
  563.  
  564.  === INSERT OF 20000 BYTE RECORDS ===
  565.  (skipping test for SDBM_File 100 byte limit)
  566.  (skipping test for MLDBM::Sync db size > 1M)
  567.   Time for 100 writes + 100 reads for  GDBM_File                  2.23 seconds   2063912 bytes
  568.   Time for 100 writes + 100 reads for  DB_File                    1.89 seconds   2060288 bytes
  569.   Time for 100 writes + 100 reads for  Tie::TextDir .04           1.26 seconds   2008192 bytes
  570.  
  571.  === INSERT OF 50000 BYTE RECORDS ===
  572.  (skipping test for SDBM_File 100 byte limit)
  573.  (skipping test for MLDBM::Sync db size > 1M)
  574.   Time for 100 writes + 100 reads for  GDBM_File                  3.66 seconds   5337944 bytes
  575.   Time for 100 writes + 100 reads for  DB_File                    3.64 seconds   5337088 bytes
  576.   Time for 100 writes + 100 reads for  Tie::TextDir .04           2.80 seconds   5008192 bytes
  577.  
  578. =head1 AUTHORS
  579.  
  580. Copyright (c) 2001-2002 Joshua Chamas, Chamas Enterprises Inc.  All rights reserved.
  581. Sponsored by development on NodeWorks http://www.nodeworks.com and Apache::ASP
  582. http://www.apache-asp.org
  583.  
  584. This program is free software; you can redistribute it
  585. and/or modify it under the same terms as Perl itself.
  586.  
  587. =head1 SEE ALSO
  588.  
  589.  MLDBM(3), SDBM_File(3), DB_File(3), GDBM_File(3)
  590.