[Bast-commits] r5014 - in DBIx-Class/0.08/trunk: lib/DBIx/Class lib/DBIx/Class/Manual t

nigel at dev.catalyst.perl.org nigel at dev.catalyst.perl.org
Tue Oct 28 09:22:42 GMT 2008


Author: nigel
Date: 2008-10-28 09:22:42 +0000 (Tue, 28 Oct 2008)
New Revision: 5014

Added:
   DBIx-Class/0.08/trunk/t/99rh_perl_perf_bug.t
Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Intro.pod
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Troubleshooting.pod
   DBIx-Class/0.08/trunk/lib/DBIx/Class/StartupCheck.pm
Log:
Merged in changes to StartupCheck, documentation and tests for Red Hat perl performance issues

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Intro.pod
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Intro.pod	2008-10-28 09:21:33 UTC (rev 5013)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Intro.pod	2008-10-28 09:22:42 UTC (rev 5014)
@@ -379,13 +379,9 @@
 
 =head2 Problems on RHEL5/CentOS5
 
-There is a problem with slow performance of certain DBIx::Class
-operations in perl-5.8.8-10 and later on RedHat and related systems, due
-to a bad backport of a "use overload" related bug. The problem is in the
-Perl binary itself, not in DBIx::Class. If your system might suffer this
-problem, you will see a warning on startup, with some options as to what
-to do about it. This problem was eliminated in the perl-5.8.8-15.el5_2.1
-package which was issued in September 2008.
+There used to be an issue with the system perl on Red Hat Enterprise
+Linux 5, some versions of Fedora and derived systems. Further
+information on this can be found in L<DBIx::Class::Manual::Troubleshooting>
 
 =head1 SEE ALSO
 

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Troubleshooting.pod
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Troubleshooting.pod	2008-10-28 09:21:33 UTC (rev 5013)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Troubleshooting.pod	2008-10-28 09:22:42 UTC (rev 5014)
@@ -123,5 +123,38 @@
 
   ... ORDER BY name DESC
 
+=head2 Perl Performance Issues on Red Hat Systems
+
+There is a problem with slow performance of certain DBIx::Class
+operations using the system perl on some Fedora and Red Hat Enterprise
+Linux system (as well as their derivative distributions such as Centos,
+White Box and Scientific Linux).
+
+Distributions affected include Fedora 5 through to Fedora 8 and RHEL5
+upto and including RHEL5 Update 2. Fedora 9 (which uses perl 5.10) has
+never been affected - this is purely a perl 5.8.8 issue.
+
+As of September 2008 the following packages are known to be fixed and so
+free of this performance issue (this means all Fedora and RHEL5 systems
+with full current updates will not be subject to this problem):-
+
+  Fedora 8     - perl-5.8.8-41.fc8
+  RHEL5        - perl-5.8.8-15.el5_2.1
+
+The issue is due to perl doing an exhaustive search of blessed objects
+under certain circumstances.  The problem shows up as performance
+degredation exponential to the number of L<DBIx::Class> row objects in
+memory, so can be unoticeable with certain data sets, but with huge
+performance impacts on other datasets.
+
+A pair of tests for susceptability to the issue, and performance effects
+of the bless/overload problem can be found in the L<DBIx::Class> test
+suite in the file C<t/99rh_perl_perf_bug.t>
+
+Further information on this issue can be found in
+L<https://bugzilla.redhat.com/show_bug.cgi?id=379791>,
+L<https://bugzilla.redhat.com/show_bug.cgi?id=460308> and
+L<http://rhn.redhat.com/errata/RHBA-2008-0876.html>
+
 =cut
 

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/StartupCheck.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/StartupCheck.pm	2008-10-28 09:21:33 UTC (rev 5013)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/StartupCheck.pm	2008-10-28 09:22:42 UTC (rev 5014)
@@ -1,35 +1,5 @@
 package DBIx::Class::StartupCheck;
 
-BEGIN {
-
-    { package # don't want this in PAUSE
-        TestRHBug; use overload bool => sub { 0 } }
-
-    sub _has_bug_34925 {
-	my %thing;
-	my $r1 = \%thing;
-	my $r2 = \%thing;
-	bless $r1 => 'TestRHBug';
-	return !!$r2;
-    }
-
-    sub _possibly_has_bad_overload_performance {
-	return $] < 5.008009 && ! _has_bug_34925();
-    }
-
-    unless ($ENV{DBIC_NO_WARN_BAD_PERL}) {
-	if (_possibly_has_bad_overload_performance()) {
-	    print STDERR "\n\nWARNING: " . __PACKAGE__ . ": This version of Perl is likely to exhibit\n" .
-		"extremely slow performance for certain critical operations.\n" .
-		"Please consider recompiling Perl.  For more information, see\n" .
-		"https://bugzilla.redhat.com/show_bug.cgi?id=196836 and/or\n" .
-		"http://lists.scsys.co.uk/pipermail/dbix-class/2007-October/005119.html.\n" .
-		"You can suppress this message by setting DBIC_NO_WARN_BAD_PERL=1 in your\n" .
-		"environment.\n\n";
-	}
-    }
-}
-
 =head1 NAME
 
 DBIx::Class::StartupCheck - Run environment checks on startup
@@ -40,15 +10,22 @@
   
 =head1 DESCRIPTION
 
-Currently this module checks for, and if necessary issues a warning for, a
-particular bug found on RedHat systems from perl-5.8.8-10 and up.  Other checks
-may be added from time to time.
+This module used to check for, and if necessary issue a warning for, a
+particular bug found on Red Hat and Fedora systems using their system
+perl build. As of September 2008 there are fixed versions of perl for
+all current Red Hat and Fedora distributions, but the old check still
+triggers, incorrectly flagging those versions of perl to be buggy. A
+more comprehensive check has been moved into the test suite in
+C<t/99rh_perl_perf_bug.t> and further information about the bug has been
+put in L<DBIx::Class::Manual::Troubleshooting>
 
+Other checks may be added from time to time.
+
 Any checks herein can be disabled by setting an appropriate environment
-variable.  If your system suffers from a particular bug, you will get a warning
-message on startup sent to STDERR, explaining what to do about it and how to
-suppress the message.  If you don't see any messages, you have nothing to worry
-about.
+variable. If your system suffers from a particular bug, you will get a
+warning message on startup sent to STDERR, explaining what to do about
+it and how to suppress the message. If you don't see any messages, you
+have nothing to worry about.
 
 =head1 CONTRIBUTORS
 

Copied: DBIx-Class/0.08/trunk/t/99rh_perl_perf_bug.t (from rev 5013, DBIx-Class/0.08/branches/doc_mods/t/99rh_perl_perf_bug.t)
===================================================================
--- DBIx-Class/0.08/trunk/t/99rh_perl_perf_bug.t	                        (rev 0)
+++ DBIx-Class/0.08/trunk/t/99rh_perl_perf_bug.t	2008-10-28 09:22:42 UTC (rev 5014)
@@ -0,0 +1,85 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Test::More;
+use lib qw(t/lib);
+
+# This is a rather unusual test.
+# It does not test any aspect of DBIx::Class, but instead tests the
+# perl installation this is being run under to see if it is:-
+#  1. Potentially affected by a RH perl build bug
+#  2. If so we do a performance test for the effect of
+#     that bug.
+#
+# You can skip these tests by setting the DBIC_NO_WARN_BAD_PERL env
+# variable
+#
+# If these tests fail then please read the section titled
+# Perl Performance Issues on Red Hat Systems in
+# L<DBIx::Class::Manual::Troubleshooting>
+
+plan skip_all =>
+  'Skipping RH perl performance bug tests as DBIC_NO_WARN_BAD_PERL set'
+  if ( $ENV{DBIC_NO_WARN_BAD_PERL} );
+
+eval "use Benchmark";
+plan skip_all => 'needs Benchmark for testing' if $@;
+
+plan tests => 2;
+
+{
+    package    # don't want this in PAUSE
+      TestRHBug;
+    use overload bool => sub { 0 }
+}
+
+sub _has_bug_34925 {
+    my %thing;
+    my $r1 = \%thing;
+    my $r2 = \%thing;
+    bless $r1 => 'TestRHBug';
+    return !!$r2;
+}
+
+sub _possibly_has_bad_overload_performance {
+    return $] < 5.008009 && !_has_bug_34925();
+}
+
+# If the test here fails, you are running a 5.88 or older perl which 
+# has been patched to correct for an issue with bless/overload, but
+# which *might* be susceptable to a severe performance issue caused
+# by a partial fix.  The performance issue is tested for in the second
+# test.
+# If *this* test fails, but the other test is OK, then you have a fixed
+# perl and no need to worry.
+ok( !_possibly_has_bad_overload_performance(),
+    'Checking not susceptable to bless/overload performance problem' );
+
+my $results = timethese(
+    -1,    # run for 1 CPU second each
+    {
+        overload => sub {
+            use overload q(<) => sub { };
+            my %h;
+            for ( my $i = 0 ; $i < 5000 ; $i++ ) {
+                $h{$i} = bless [] => 'main';
+            }
+        },
+        nooverload => sub {
+            my %h;
+            for ( my $i = 0 ; $i < 5000 ; $i++ ) {
+                $h{$i} = bless [] => 'main';
+            }
+          }
+    }
+);
+
+# we are OK if there is less than a factor of 2 difference here
+ok( ( ( $results->{nooverload}->iters / $results->{overload}->iters ) < 2 ),
+    'Overload/bless performance acceptable' );
+# if the test above failed, look at the section titled
+# Perl Performance Issues on Red Hat Systems in
+# L<DBIx::Class::Manual::Troubleshooting>
+# Basically you may suffer severe performance issues when running
+# DBIx::Class (and many other) modules.  Look at getting a fixed
+# version of the perl interpreter for your system.




More information about the Bast-commits mailing list