You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Victor J. Orlikowski" <vj...@raleigh.ibm.com> on 2000/06/08 23:30:15 UTC

[PATCH] Make AIX versions 4.3 and above use pthreads for locking in 1.3

Hullo all.

A fellow around here has had some trouble with massively parallel AIX boxes
and fcntl style locking.
Mostly, the story comes to a degradation of performance with an increased
number of clients on a large number of CPUs due to blocking in fcntl for
long period of time (possibly as a result of horridly broken locking in
AIX). Measurements seem to bear out that sysV semaphores and pthreads bring
astounding improvements, but sysV sems have the known problems (cgi DOS,
failure of cleanup).
Therefore, this patch puts in place pthread-based locking on AIX.

Index: src/Configure
===================================================================
RCS file: /cvs/apache/apache-1.3/src/Configure,v
retrieving revision 1.397
diff -u -r1.397 Configure
--- Configure   2000/04/18 19:26:28     1.397
+++ Configure   2000/06/08 17:19:29
@@ -316,8 +316,8 @@
        ;;
     *-ibm-aix4.3)
        OS='IBM AIX 4.3'
-       CFLAGS="$CFLAGS -DAIX=43 -U__STR__"
-       LDFLAGS="$LDFLAGS -lm"
+       CFLAGS="$CFLAGS -DAIX=43 -DUSE_PTHREAD_SERIALIZED_ACCEPT -U__STR__"
+       LDFLAGS="$LDFLAGS -lm -lpthread"
        RULE_SHARED_CORE=no
        DEF_SHARED_CORE=no
        ;;

Index: src/include/ap_config.h
===================================================================
RCS file: /cvs/apache/apache-1.3/src/include/ap_config.h,v
retrieving revision 1.287
diff -u -r1.287 ap_config.h
--- ap_config.h 2000/06/01 23:42:23     1.287
+++ ap_config.h 2000/06/08 17:19:30
@@ -268,7 +268,9 @@
 #ifdef NEED_RLIM_T
 typedef int rlim_t;
 #endif
+#if !defined(USE_PTHREAD_SERIALIZED_ACCEPT)
 #define USE_FCNTL_SERIALIZED_ACCEPT
+#endif
 #ifdef USEBCOPY
 #define memmove(a,b,c) bcopy(b,a,c)
 #endif



Re: [PATCH] Make AIX versions 4.3 and above use pthreads for locking in 1.3

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
All right, I rescind my veto.
-- 
#ken    P-)}

Ken Coar                    <http://Golux.Com/coar/>
Apache Software Foundation  <http://www.apache.org/>
"Apache Server for Dummies" <http://Apache-Server.Com/>
"Apache Server Unleashed"   <http://ApacheUnleashed.Com/>

Re: [PATCH] Make AIX versions 4.3 and above use pthreads for locking in 1.3

Posted by Bill Stoddard <st...@raleigh.ibm.com>.
> "Victor J. Orlikowski" wrote:
> >
> > Therefore, this patch puts in place pthread-based locking on AIX.
>
> ISTR that successive releases of AIX differ, um, wildly.  This
> may be the best bet for 4.3.2 (and later), but please verify that
> it's correct for earlier versions as well -- or else special-case
> the 4.3.2-and-later somehow.
>

Your probably thinking of AIX 4.2.*, which uses pthreads draft 7. And yes, it can differ
wildly from the final pthread spec used in AIX 4.3.  Reliable sources assure me the
pthreads support is consistent in 4.3.*, so I'd rather not use Victors checkdefine script.
The existing check for AIX 4.3 is sufficient.

My concern is that there are problems with the implementation of the cross process pthread
mutex. Time will tell.  To deal with this possibility, I plan to build two Apache 1.3.13
binary kits. The first kit will be built on AIX 4.3.2 and thus will use the pthread mutex.
A fallback kit will be built on AIX 4.2.1 and will use fcntl locking. The 4.2.1 kit will
run on 4.3.

> Also, 1.3 canonically uses '#ifndef', not '#if !defined'. :-)

Could've fooled me :-). #if !defined is used all over the place in ap_config.h.

Bill



Re: [PATCH] Make AIX versions 4.3 and above use pthreads for locking in 1.3

Posted by "Victor J. Orlikowski" <vj...@raleigh.ibm.com>.
Ok, following Manoj's advice, here is the resubmit.
Added a new helper script to check the presence of a #define in a header
file for 1.3.x

# This file needs adding to cvs.

Index: src/helpers/checkdefine.sh
#!/bin/sh
##
##  checkdefine.sh -- Check whether a define exists in a header
##   Modified from Ralf S. Engelschall's checkheader.sh
##   by Victor Orlikowski for the Apache configuration mechanism
##
#
# This script falls under the Apache License.
# See http://www.apache.org/docs/LICENSE


header=$1
define=$2
rc=1
if [ "x$CPP" = "x" ]; then
    CPP='NOT-AVAILABLE'
fi
if [ "x$CPP" != "xNOT-AVAILABLE" ]; then
    #   create a test C source
    cat >conftest.c <<EOF
#include <$header>
#ifdef $define
YES_IS_DEFINED
#endif
EOF
    if (eval "$CPP conftest.c") 2>/dev/null |
        egrep "YES_IS_DEFINED" >/dev/null 2>&1; then
        rc=0
    fi
fi
rm -f conftest.*
exit $rc


Index: src/Configure
===================================================================
RCS file: /cvs/apache/apache-1.3/src/Configure,v
retrieving revision 1.397
diff -u -r1.397 Configure
--- Configure 2000/04/18 19:26:28 1.397
+++ Configure 2000/06/13 15:34:15
@@ -967,11 +967,18 @@
 ####################################################################
 # Special AIX 4.x support: need to check for sys/processor.h
 # to decide whether the Processor Binding can be used or not
+# ADDENDUM: For large SMP boxen, AIX likes pthreads. Check to make
+# sure these work OK, then put them in.
 case "$PLAT" in
     *-ibm-aix*)
  CPP=$CPP ./helpers/checkheader.sh sys/processor.h
  if [ $? -eq 0 ]; then
      CFLAGS="$CFLAGS -DAIX_BIND_PROCESSOR"
+ fi
+ CPP=$CPP ./helpers/checkdefine.sh pthread.h PTHREAD_PROCESS_SHARED
+ if [ $? -eq 0 ]; then
+     CFLAGS="$CFLAGS -DUSE_PTHREAD_SERIALIZED_ACCEPT"
+     LDFLAGS="$LDFLAGS -lpthread"
  fi
  ;;
 esac
Index: src/include/ap_config.h
===================================================================
RCS file: /cvs/apache/apache-1.3/src/include/ap_config.h,v
retrieving revision 1.287
diff -u -r1.287 ap_config.h
--- ap_config.h 2000/06/01 23:42:23 1.287
+++ ap_config.h 2000/06/13 15:34:16
@@ -268,7 +268,9 @@
 #ifdef NEED_RLIM_T
 typedef int rlim_t;
 #endif
+#ifndef USE_PTHREAD_SERIALIZED_ACCEPT
 #define USE_FCNTL_SERIALIZED_ACCEPT
+#endif
 #ifdef USEBCOPY
 #define memmove(a,b,c) bcopy(b,a,c)
 #endif



Re: [PATCH] Make AIX versions 4.3 and above use pthreads for locking in 1.3

Posted by Manoj Kasichainula <ma...@io.com>.
On Fri, Jun 09, 2000 at 12:56:16PM -0400, Rodent of Unusual Size wrote:
> "Victor J. Orlikowski" wrote:
> > 
> > Therefore, this patch puts in place pthread-based locking on AIX.
> 
> ISTR that successive releases of AIX differ, um, wildly.  This
> may be the best bet for 4.3.2 (and later), but please verify that
> it's correct for earlier versions as well -- or else special-case
> the 4.3.2-and-later somehow.

ISTR that you could check #ifdef PTHREAD_PROCESS_SHARED to
correctly determine whether a version of AIX properly supported
cross-process pthread mutexes. In fact, this is what 2.0 seems to do
now in APR, and I think I committed a patch to do this in 2.0 before
APR took over locking.


Re: [PATCH] Make AIX versions 4.3 and above use pthreads for locking in 1.3

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
"Victor J. Orlikowski" wrote:
> 
> Therefore, this patch puts in place pthread-based locking on AIX.

ISTR that successive releases of AIX differ, um, wildly.  This
may be the best bet for 4.3.2 (and later), but please verify that
it's correct for earlier versions as well -- or else special-case
the 4.3.2-and-later somehow.

Also, 1.3 canonically uses '#ifndef', not '#if !defined'. :-)
-- 
#ken    P-)}

Ken Coar                    <http://Golux.Com/coar/>
Apache Software Foundation  <http://www.apache.org/>
"Apache Server for Dummies" <http://Apache-Server.Com/>
"Apache Server Unleashed"   <http://ApacheUnleashed.Com/>