You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ja...@apache.org on 2014/10/09 18:45:58 UTC
git commit: Integrate Sigar library and add basic OS performance
checks on startup
Repository: cassandra
Updated Branches:
refs/heads/trunk 7892b8355 -> 861c4cf2d
Integrate Sigar library and add basic OS performance checks on startup
Patch by Amit Kumar and Josh McKenzie; reviewed by tjake for (CASSANDRA-7838)
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/861c4cf2
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/861c4cf2
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/861c4cf2
Branch: refs/heads/trunk
Commit: 861c4cf2de9075c721945fb7ef84a23030a4f35a
Parents: 7892b83
Author: Joshua McKenzie <jo...@datastax.com>
Authored: Wed Oct 8 17:08:11 2014 -0500
Committer: Jake Luciani <ja...@apache.org>
Committed: Thu Oct 9 12:32:57 2014 -0400
----------------------------------------------------------------------
CHANGES.txt | 1 +
NOTICE.txt | 3 +
bin/cassandra.bat | 5 +-
bin/cassandra.in.bat | 3 +
bin/cassandra.in.sh | 3 +
build.xml | 3 +
conf/cassandra-env.ps1 | 3 +
conf/cassandra-env.sh | 5 +
debian/cassandra.install | 1 +
lib/licenses/sigar-1.6.4.txt | 201 +++++++++++++++++++
lib/sigar-1.6.4.jar | Bin 0 -> 428580 bytes
lib/sigar-bin/libsigar-amd64-freebsd-6.so | Bin 0 -> 210641 bytes
lib/sigar-bin/libsigar-amd64-linux.so | Bin 0 -> 246605 bytes
lib/sigar-bin/libsigar-amd64-solaris.so | Bin 0 -> 251360 bytes
lib/sigar-bin/libsigar-ia64-hpux-11.sl | Bin 0 -> 577452 bytes
lib/sigar-bin/libsigar-ia64-linux.so | Bin 0 -> 494929 bytes
lib/sigar-bin/libsigar-pa-hpux-11.sl | Bin 0 -> 516096 bytes
lib/sigar-bin/libsigar-ppc-aix-5.so | Bin 0 -> 400925 bytes
lib/sigar-bin/libsigar-ppc-linux.so | Bin 0 -> 258547 bytes
lib/sigar-bin/libsigar-ppc64-aix-5.so | Bin 0 -> 425077 bytes
lib/sigar-bin/libsigar-ppc64-linux.so | Bin 0 -> 330767 bytes
lib/sigar-bin/libsigar-s390x-linux.so | Bin 0 -> 269932 bytes
lib/sigar-bin/libsigar-sparc-solaris.so | Bin 0 -> 285004 bytes
lib/sigar-bin/libsigar-sparc64-solaris.so | Bin 0 -> 261896 bytes
lib/sigar-bin/libsigar-universal-macosx.dylib | Bin 0 -> 377668 bytes
lib/sigar-bin/libsigar-universal64-macosx.dylib | Bin 0 -> 397440 bytes
lib/sigar-bin/libsigar-x86-freebsd-5.so | Bin 0 -> 179751 bytes
lib/sigar-bin/libsigar-x86-freebsd-6.so | Bin 0 -> 179379 bytes
lib/sigar-bin/libsigar-x86-linux.so | Bin 0 -> 233385 bytes
lib/sigar-bin/libsigar-x86-solaris.so | Bin 0 -> 242880 bytes
lib/sigar-bin/sigar-amd64-winnt.dll | Bin 0 -> 402432 bytes
lib/sigar-bin/sigar-x86-winnt.dll | Bin 0 -> 266240 bytes
lib/sigar-bin/sigar-x86-winnt.lib | Bin 0 -> 99584 bytes
.../cassandra/service/CassandraDaemon.java | 20 +-
.../apache/cassandra/utils/SigarLibrary.java | 181 +++++++++++++++++
35 files changed, 422 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 5ec542c..be80ee3 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.0
+ * Add Sigar library and perform basic OS settings check on startup (CASSANDRA-7838)
* Support for scripting languages in user-defined functions (CASSANDRA-7526)
* Support for aggregation functions (CASSANDRA-4914)
* Improve query to read paxos table on propose (CASSANDRA-7929)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/NOTICE.txt
----------------------------------------------------------------------
diff --git a/NOTICE.txt b/NOTICE.txt
index bbe21d7..2fe15f5 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -63,3 +63,6 @@ HLL++ support provided by stream-lib
Javassist
(http://www.csg.ci.i.u-tokyo.ac.jp/~chiba/javassist/)
+
+SIGAR
+http://sigar.hyperic.com/
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/bin/cassandra.bat
----------------------------------------------------------------------
diff --git a/bin/cassandra.bat b/bin/cassandra.bat
index 1606dcc..cba69c6 100644
--- a/bin/cassandra.bat
+++ b/bin/cassandra.bat
@@ -18,7 +18,6 @@
if "%OS%" == "Windows_NT" setlocal
set ARG=%1
-if /i "%ARG%" == "LEGACY" goto runLegacy
set INSTALL="INSTALL"
set UNINSTALL="UNINSTALL"
@@ -26,6 +25,7 @@ pushd %~dp0..
if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%CD%
popd
+if /i "%ARG%" == "LEGACY" goto runLegacy
REM -----------------------------------------------------------------------------
REM See if we have access to run unsigned powershell scripts
for /F "delims=" %%i in ('powershell Get-ExecutionPolicy') do set PERMISSION=%%i
@@ -67,7 +67,8 @@ set JAVA_OPTS=-ea^
-Dcom.sun.management.jmxremote.port=7199^
-Dcom.sun.management.jmxremote.ssl=false^
-Dcom.sun.management.jmxremote.authenticate=false^
- -Dlogback.configurationFile=logback.xml
+ -Dlogback.configurationFile=logback.xml^
+ -Djava.library.path=%CASSANDRA_HOME%\lib\sigar-bin
REM ***** CLASSPATH library setting *****
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/bin/cassandra.in.bat
----------------------------------------------------------------------
diff --git a/bin/cassandra.in.bat b/bin/cassandra.in.bat
index e3304e7..a0eced5 100644
--- a/bin/cassandra.in.bat
+++ b/bin/cassandra.in.bat
@@ -48,3 +48,6 @@ set CASSANDRA_CLASSPATH=%CLASSPATH%;"%CASSANDRA_HOME%\build\classes\main";%CASSA
REM Add the default storage location. Can be overridden in conf\cassandra.yaml
set CASSANDRA_PARAMS=%CASSANDRA_PARAMS% "-Dcassandra.storagedir=%CASSANDRA_HOME%\data"
+
+REM Add the sigar-bin path to the java.library.path CASSANDRA-7838
+set JAVA_OPTS=%JAVA_OPTS% -Djava.library.path=%CASSANDRA_HOME%\lib\sigar-bin"
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/bin/cassandra.in.sh
----------------------------------------------------------------------
diff --git a/bin/cassandra.in.sh b/bin/cassandra.in.sh
index 368c40e..ed124bc 100644
--- a/bin/cassandra.in.sh
+++ b/bin/cassandra.in.sh
@@ -50,3 +50,6 @@ if [ "$JVM_VENDOR" != "OpenJDK" -o "$JVM_VERSION" \> "1.6.0" ] \
then
JAVA_AGENT="$JAVA_AGENT -javaagent:$CASSANDRA_HOME/lib/jamm-0.2.6.jar"
fi
+
+# Added sigar-bin to the java.library.path CASSANDRA-7838
+JAVA_OPTS="$JAVA_OPTS:-Djava.library.path=$CASSANDRA_HOME/lib/sigar-bin"
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index eaa1b60..708b950 100644
--- a/build.xml
+++ b/build.xml
@@ -369,6 +369,7 @@
<dependency groupId="org.javassist" artifactId="javassist" version="3.18.2-GA" />
<dependency groupId="net.sf.supercsv" artifactId="super-csv" version="2.1.0" />
<dependency groupId="net.ju-n.compile-command-annotations" artifactId="compile-command-annotations" version="1.2.0" />
+ <dependency groupId="org.fusesource" artifactId="sigar" version="1.6.4" />
</dependencyManagement>
<developer id="alakshman" name="Avinash Lakshman"/>
<developer id="aleksey" name="Aleksey Yeschenko"/>
@@ -490,6 +491,8 @@
<!-- don't need jamm unless running a server in which case it needs to be a -javagent to be used anyway -->
<dependency groupId="com.github.jbellis" artifactId="jamm"/>
<dependency groupId="io.netty" artifactId="netty-all"/>
+
+ <dependency groupId="org.fusesource" artifactId="sigar" version="1.6.4"/>
</artifact:pom>
<artifact:pom id="thrift-pom"
artifactId="cassandra-thrift"
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/conf/cassandra-env.ps1
----------------------------------------------------------------------
diff --git a/conf/cassandra-env.ps1 b/conf/cassandra-env.ps1
index 47f4fa3..85136a8 100644
--- a/conf/cassandra-env.ps1
+++ b/conf/cassandra-env.ps1
@@ -292,6 +292,9 @@ Function SetCassandraEnvironment
CalculateHeapSizes
ParseJVMInfo
+ # Add sigar env - see Cassandra-7838
+ $env:JVM_OPTS = "$env:JVM_OPTS -Djava.library.path=$env:CASSANDRA_HOME\lib\sigar-bin"
+
# add the jamm javaagent
if (($env:JVM_VENDOR -ne "OpenJDK") -or ($env:JVM_VERSION.CompareTo("1.6.0") -eq 1) -or
(($env:JVM_VERSION -eq "1.6.0") -and ($env:JVM_PATCH_VERSION.CompareTo("22") -eq 1)))
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/conf/cassandra-env.sh
----------------------------------------------------------------------
diff --git a/conf/cassandra-env.sh b/conf/cassandra-env.sh
index 875cbeb..a0ab30d 100644
--- a/conf/cassandra-env.sh
+++ b/conf/cassandra-env.sh
@@ -275,6 +275,11 @@ JVM_OPTS="$JVM_OPTS -Djava.net.preferIPv4Stack=true"
#MX4J_ADDRESS="-Dmx4jaddress=127.0.0.1"
#MX4J_PORT="-Dmx4jport=8081"
+# Cassandra uses SIGAR to capture OS metrics CASSANDRA-7838
+# for SIGAR we have to set the java.library.path
+# to the location of the native libraries.
+JVM_OPTS="$JVM_OPTS -Djava.library.path=$CASSANDRA_HOME/lib/sigar-bin"
+
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=false"
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/debian/cassandra.install
----------------------------------------------------------------------
diff --git a/debian/cassandra.install b/debian/cassandra.install
index 2fbbac1..7f5aa10 100644
--- a/debian/cassandra.install
+++ b/debian/cassandra.install
@@ -20,4 +20,5 @@ bin/sstableupgrade usr/bin
tools/bin/cassandra-stress usr/bin
lib/*.jar usr/share/cassandra/lib
lib/*.zip usr/share/cassandra/lib
+lib/sigar-bin/* usr/share/cassandra/lib/sigar-bin
lib/licenses usr/share/doc/cassandra
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/licenses/sigar-1.6.4.txt
----------------------------------------------------------------------
diff --git a/lib/licenses/sigar-1.6.4.txt b/lib/licenses/sigar-1.6.4.txt
new file mode 100644
index 0000000..11069ed
--- /dev/null
+++ b/lib/licenses/sigar-1.6.4.txt
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-1.6.4.jar
----------------------------------------------------------------------
diff --git a/lib/sigar-1.6.4.jar b/lib/sigar-1.6.4.jar
new file mode 100644
index 0000000..58c733c
Binary files /dev/null and b/lib/sigar-1.6.4.jar differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-amd64-freebsd-6.so
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-amd64-freebsd-6.so b/lib/sigar-bin/libsigar-amd64-freebsd-6.so
new file mode 100644
index 0000000..3e94f0d
Binary files /dev/null and b/lib/sigar-bin/libsigar-amd64-freebsd-6.so differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-amd64-linux.so
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-amd64-linux.so b/lib/sigar-bin/libsigar-amd64-linux.so
new file mode 100644
index 0000000..5a2e4c2
Binary files /dev/null and b/lib/sigar-bin/libsigar-amd64-linux.so differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-amd64-solaris.so
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-amd64-solaris.so b/lib/sigar-bin/libsigar-amd64-solaris.so
new file mode 100644
index 0000000..6396482
Binary files /dev/null and b/lib/sigar-bin/libsigar-amd64-solaris.so differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-ia64-hpux-11.sl
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-ia64-hpux-11.sl b/lib/sigar-bin/libsigar-ia64-hpux-11.sl
new file mode 100644
index 0000000..d92ea4a
Binary files /dev/null and b/lib/sigar-bin/libsigar-ia64-hpux-11.sl differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-ia64-linux.so
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-ia64-linux.so b/lib/sigar-bin/libsigar-ia64-linux.so
new file mode 100644
index 0000000..2bd2fc8
Binary files /dev/null and b/lib/sigar-bin/libsigar-ia64-linux.so differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-pa-hpux-11.sl
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-pa-hpux-11.sl b/lib/sigar-bin/libsigar-pa-hpux-11.sl
new file mode 100644
index 0000000..0dfd8a1
Binary files /dev/null and b/lib/sigar-bin/libsigar-pa-hpux-11.sl differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-ppc-aix-5.so
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-ppc-aix-5.so b/lib/sigar-bin/libsigar-ppc-aix-5.so
new file mode 100644
index 0000000..7d4b519
Binary files /dev/null and b/lib/sigar-bin/libsigar-ppc-aix-5.so differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-ppc-linux.so
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-ppc-linux.so b/lib/sigar-bin/libsigar-ppc-linux.so
new file mode 100644
index 0000000..4394b1b
Binary files /dev/null and b/lib/sigar-bin/libsigar-ppc-linux.so differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-ppc64-aix-5.so
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-ppc64-aix-5.so b/lib/sigar-bin/libsigar-ppc64-aix-5.so
new file mode 100644
index 0000000..35fd828
Binary files /dev/null and b/lib/sigar-bin/libsigar-ppc64-aix-5.so differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-ppc64-linux.so
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-ppc64-linux.so b/lib/sigar-bin/libsigar-ppc64-linux.so
new file mode 100644
index 0000000..a1ba252
Binary files /dev/null and b/lib/sigar-bin/libsigar-ppc64-linux.so differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-s390x-linux.so
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-s390x-linux.so b/lib/sigar-bin/libsigar-s390x-linux.so
new file mode 100644
index 0000000..c275f4a
Binary files /dev/null and b/lib/sigar-bin/libsigar-s390x-linux.so differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-sparc-solaris.so
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-sparc-solaris.so b/lib/sigar-bin/libsigar-sparc-solaris.so
new file mode 100644
index 0000000..aa847d2
Binary files /dev/null and b/lib/sigar-bin/libsigar-sparc-solaris.so differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-sparc64-solaris.so
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-sparc64-solaris.so b/lib/sigar-bin/libsigar-sparc64-solaris.so
new file mode 100644
index 0000000..6c4fe80
Binary files /dev/null and b/lib/sigar-bin/libsigar-sparc64-solaris.so differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-universal-macosx.dylib
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-universal-macosx.dylib b/lib/sigar-bin/libsigar-universal-macosx.dylib
new file mode 100644
index 0000000..27ab107
Binary files /dev/null and b/lib/sigar-bin/libsigar-universal-macosx.dylib differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-universal64-macosx.dylib
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-universal64-macosx.dylib b/lib/sigar-bin/libsigar-universal64-macosx.dylib
new file mode 100644
index 0000000..0c721fe
Binary files /dev/null and b/lib/sigar-bin/libsigar-universal64-macosx.dylib differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-x86-freebsd-5.so
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-x86-freebsd-5.so b/lib/sigar-bin/libsigar-x86-freebsd-5.so
new file mode 100644
index 0000000..8c50c61
Binary files /dev/null and b/lib/sigar-bin/libsigar-x86-freebsd-5.so differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-x86-freebsd-6.so
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-x86-freebsd-6.so b/lib/sigar-bin/libsigar-x86-freebsd-6.so
new file mode 100644
index 0000000..f080027
Binary files /dev/null and b/lib/sigar-bin/libsigar-x86-freebsd-6.so differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-x86-linux.so
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-x86-linux.so b/lib/sigar-bin/libsigar-x86-linux.so
new file mode 100644
index 0000000..a0b64ed
Binary files /dev/null and b/lib/sigar-bin/libsigar-x86-linux.so differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/libsigar-x86-solaris.so
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/libsigar-x86-solaris.so b/lib/sigar-bin/libsigar-x86-solaris.so
new file mode 100644
index 0000000..c6452e5
Binary files /dev/null and b/lib/sigar-bin/libsigar-x86-solaris.so differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/sigar-amd64-winnt.dll
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/sigar-amd64-winnt.dll b/lib/sigar-bin/sigar-amd64-winnt.dll
new file mode 100644
index 0000000..1ec8a03
Binary files /dev/null and b/lib/sigar-bin/sigar-amd64-winnt.dll differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/sigar-x86-winnt.dll
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/sigar-x86-winnt.dll b/lib/sigar-bin/sigar-x86-winnt.dll
new file mode 100644
index 0000000..6afdc01
Binary files /dev/null and b/lib/sigar-bin/sigar-x86-winnt.dll differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/lib/sigar-bin/sigar-x86-winnt.lib
----------------------------------------------------------------------
diff --git a/lib/sigar-bin/sigar-x86-winnt.lib b/lib/sigar-bin/sigar-x86-winnt.lib
new file mode 100644
index 0000000..04924a1
Binary files /dev/null and b/lib/sigar-bin/sigar-x86-winnt.lib differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/src/java/org/apache/cassandra/service/CassandraDaemon.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/CassandraDaemon.java b/src/java/org/apache/cassandra/service/CassandraDaemon.java
index 2baf3fe..cc81c4f 100644
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@ -33,6 +33,7 @@ import javax.management.StandardMBean;
import com.google.common.collect.Iterables;
import com.google.common.util.concurrent.Uninterruptibles;
+import org.hyperic.sigar.SigarException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -85,7 +86,7 @@ public class CassandraDaemon
*/
protected void setup()
{
- try
+ try
{
logger.info("Hostname: {}", InetAddress.getLocalHost().getHostName());
}
@@ -178,6 +179,13 @@ public class CassandraDaemon
Iterable<String> dirs = Iterables.concat(Arrays.asList(DatabaseDescriptor.getAllDataFileLocations()),
Arrays.asList(DatabaseDescriptor.getCommitLogLocation(),
DatabaseDescriptor.getSavedCachesLocation()));
+
+ SigarLibrary sigarLibrary = new SigarLibrary();
+ if (sigarLibrary.initialized())
+ sigarLibrary.warnIfRunningInDegradedMode();
+ else
+ logger.info("Sigar could not be initialized");
+
for (String dataDir : dirs)
{
logger.debug("Checking directory {}", dataDir);
@@ -200,6 +208,8 @@ public class CassandraDaemon
// if permissions aren't sufficient, stop cassandra.
System.exit(3);
}
+
+
}
if (CacheService.instance == null) // should never happen
@@ -441,7 +451,7 @@ public class CassandraDaemon
logger.error("error registering MBean {}", MBEAN_NAME, e);
//Allow the server to start even if the bean can't be registered
}
-
+
setup();
if (pidFile != null)
@@ -533,15 +543,15 @@ public class CassandraDaemon
{
instance.activate();
}
-
+
static class NativeAccess implements NativeAccessMBean
{
public boolean isAvailable()
{
return CLibrary.jnaAvailable();
}
-
- public boolean isMemoryLockable()
+
+ public boolean isMemoryLockable()
{
return CLibrary.jnaMemoryLockable();
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/861c4cf2/src/java/org/apache/cassandra/utils/SigarLibrary.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/SigarLibrary.java b/src/java/org/apache/cassandra/utils/SigarLibrary.java
new file mode 100644
index 0000000..bcfa58e
--- /dev/null
+++ b/src/java/org/apache/cassandra/utils/SigarLibrary.java
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cassandra.utils;
+
+import org.hyperic.sigar.*;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
+
+public class SigarLibrary
+{
+ private Logger logger = LoggerFactory.getLogger(SigarLibrary.class);
+
+ private Sigar sigar;
+ private FileSystemMap mounts = null;
+ private boolean initialized = false;
+ private long INFINITY = -1;
+ private long EXPECTED_MIN_NOFILE = 10000l; // number of files that can be opened
+ private long EXPECTED_NPROC = 32768l; // number of processes
+ private long EXPECTED_AS = INFINITY; // address space
+
+ // TODO: Determine memlock limits if possible
+ // TODO: Determine if file system is remote or local
+ // TODO: Determine if disk latency is within acceptable limits
+
+ public SigarLibrary()
+ {
+ logger.info("Initializing SIGAR library");
+ try
+ {
+ sigar = new Sigar();
+ mounts = sigar.getFileSystemMap();
+ initialized = true;
+ }
+ catch (SigarException e)
+ {
+ logger.info("Could not initialize SIGAR library {} ", e.getMessage());
+ }
+ catch (UnsatisfiedLinkError linkError)
+ {
+ logger.info("Could not initialize SIGAR library {} ", linkError.getMessage());
+ }
+ }
+
+ /**
+ *
+ * @return true or false indicating if sigar was successfully initialized
+ */
+ public boolean initialized()
+ {
+ return initialized;
+ }
+
+ private boolean hasAcceptableProcNumber()
+ {
+ try
+ {
+ long fileMax = sigar.getResourceLimit().getProcessesMax();
+ if (fileMax >= EXPECTED_NPROC || fileMax == INFINITY)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ catch (SigarException sigarException)
+ {
+ logger.warn("Could not determine if max processes was acceptable. Error message: " + sigarException);
+ return false;
+ }
+ }
+
+ private boolean hasAcceptableFileLimits()
+ {
+ try
+ {
+ long fileMax = sigar.getResourceLimit().getOpenFilesMax();
+ if (fileMax >= EXPECTED_MIN_NOFILE || fileMax == INFINITY)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ catch (SigarException sigarException)
+ {
+ logger.warn("Could not determine if max open file handle limit is correctly configured. Error message: " + sigarException);
+ return false;
+ }
+ }
+
+ private boolean hasAcceptableAddressSpace()
+ {
+ // Check is invalid on Windows
+ if (!FBUtilities.isUnix())
+ return true;
+
+ try
+ {
+ long fileMax = sigar.getResourceLimit().getVirtualMemoryMax();
+ if (fileMax == EXPECTED_AS)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ catch (SigarException sigarException)
+ {
+ logger.warn("Could not determine if VirtualMemoryMax was acceptable. Error message: " + sigarException);
+ return false;
+ }
+ }
+
+ private boolean isSwapEnabled()
+ {
+ try
+ {
+ Swap swap = sigar.getSwap();
+ long swapSize = swap.getTotal();
+ if (swapSize > 0)
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ catch (SigarException sigarException)
+ {
+ logger.warn("Could not determine if swap configuration is acceptable. Error message: " + sigarException);
+ return false;
+ }
+ }
+
+ public void warnIfRunningInDegradedMode()
+ {
+ if (initialized)
+ {
+ boolean swapEnabled = isSwapEnabled();
+ boolean goodAddressSpace = hasAcceptableAddressSpace();
+ boolean goodFileLimits = hasAcceptableFileLimits();
+ boolean goodProcNumber = hasAcceptableProcNumber();
+ if (swapEnabled || !goodAddressSpace || !goodFileLimits || !goodProcNumber)
+ {
+ logger.warn("Cassandra server running in degraded mode. Is swap disabled? : {}, Address space adequate? : {}, " +
+ " nofile limit adequate? : {}, nproc limit adequate? : {} ", swapEnabled, goodAddressSpace,
+ goodFileLimits, goodProcNumber );
+ }
+ else
+ {
+ logger.info("Checked OS settings and found them configured for optimal performance.");
+ }
+ }
+ else
+ {
+ logger.info("Sigar could not be initialized, test for checking degraded mode omitted.");
+ }
+ }
+}