You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sn...@apache.org on 2015/05/12 10:41:26 UTC

cassandra git commit: Startup slowdown due to preloading jemalloc

Repository: cassandra
Updated Branches:
  refs/heads/trunk cf6f7c163 -> 7b23b95fd


Startup slowdown due to preloading jemalloc

Patch by Robert Stupp; Reviewed by Philip Thompson for CASSANDRA-9197


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/7b23b95f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/7b23b95f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/7b23b95f

Branch: refs/heads/trunk
Commit: 7b23b95fdecb9b756cff6a0884c73906e67e65dc
Parents: cf6f7c1
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue May 12 10:40:10 2015 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Tue May 12 10:40:10 2015 +0200

----------------------------------------------------------------------
 CHANGES.txt           |  2 +-
 conf/cassandra-env.sh | 30 ++++++++----------------------
 2 files changed, 9 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/7b23b95f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 4edbeee..0a513ad 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -37,7 +37,7 @@
  * Avoid memory allocation when searching index summary (CASSANDRA-8793)
  * Optimise (Time)?UUIDType Comparisons (CASSANDRA-8730)
  * Make CRC32Ex into a separate maven dependency (CASSANDRA-8836)
- * Use preloaded jemalloc w/ Unsafe (CASSANDRA-8714)
+ * Use preloaded jemalloc w/ Unsafe (CASSANDRA-8714, 9197)
  * Avoid accessing partitioner through StorageProxy (CASSANDRA-8244, 8268)
  * Upgrade Metrics library and remove depricated metrics (CASSANDRA-5657)
  * Serializing Row cache alternative, fully off heap (CASSANDRA-7438)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7b23b95f/conf/cassandra-env.sh
----------------------------------------------------------------------
diff --git a/conf/cassandra-env.sh b/conf/cassandra-env.sh
index bc2ab28..7b9ea28 100644
--- a/conf/cassandra-env.sh
+++ b/conf/cassandra-env.sh
@@ -170,22 +170,10 @@ fi
 #
 find_library()
 {
-    lname=$1
-    shift
-    lext=$1
-    shift
-    while [ ! -z $1 ] ; do
-        path=$1
-        shift
-        for dir in $(echo $path | tr ":" " ") ; do
-            if [ -d $dir ] ; then
-                if [ -f $dir/$lname$lext ] ; then
-                    echo $dir/$lname$lext
-                    return
-                fi
-            fi
-        done
-    done
+    pattern=$1
+    path=$(echo ${2} | tr ":" " ")
+
+    find $path -regex "$pattern" -print 2>/dev/null | head -n 1
 }
 case "`uname -s`" in
     Linux)
@@ -193,15 +181,13 @@ case "`uname -s`" in
             which ldconfig > /dev/null 2>&1
             if [ $? = 0 ] ; then
                 # e.g. for CentOS
-                dirs=`ldconfig -v 2>/dev/null | grep -v ^$'\t' | sed 's/^\([^:]*\):.*$/\1/'`
+                dirs="/lib64 /lib /usr/lib64 /usr/lib `ldconfig -v 2>/dev/null | grep -v ^$'\t' | sed 's/^\([^:]*\):.*$/\1/'`"
             else
                 # e.g. for Debian, OpenSUSE
                 dirs="/lib64 /lib /usr/lib64 /usr/lib `cat /etc/ld.so.conf /etc/ld.so.conf.d/*.conf | grep '^/'`"
             fi
-            CASSANDRA_LIBJEMALLOC=$(find_library libjemalloc .so $dirs)
-        fi
-        if [ -z $CASSANDRA_LIBJEMALLOC ] ; then
-            CASSANDRA_LIBJEMALLOC=$(find_library libjemalloc .so.1 $dirs)
+            dirs=`echo $dirs | tr " " ":"`
+            CASSANDRA_LIBJEMALLOC=$(find_library '.*/libjemalloc\.so\(\.1\)*' $dirs)
         fi
         if [ ! -z $CASSANDRA_LIBJEMALLOC ] ; then
             if [ "-" != "$CASSANDRA_LIBJEMALLOC" ] ; then
@@ -211,7 +197,7 @@ case "`uname -s`" in
     ;;
     Darwin)
         if [ -z $CASSANDRA_LIBJEMALLOC ] ; then
-            CASSANDRA_LIBJEMALLOC=$(find_library libjemalloc .dylib $DYLD_LIBRARY_PATH ${DYLD_FALLBACK_LIBRARY_PATH-$HOME/lib:/usr/local/lib:/lib:/usr/lib})
+            CASSANDRA_LIBJEMALLOC=$(find_library '.*/libjemalloc\.dylib' $DYLD_LIBRARY_PATH:${DYLD_FALLBACK_LIBRARY_PATH-$HOME/lib:/usr/local/lib:/lib:/usr/lib})
         fi
         if [ ! -z $CASSANDRA_LIBJEMALLOC ] ; then
             if [ "-" != "$CASSANDRA_LIBJEMALLOC" ] ; then