diff --git a/hg-store-client/src/main/java/org/apache/hugegraph/store/client/grpc/GrpcStoreNodeSessionImpl.java b/hg-store-client/src/main/java/org/apache/hugegraph/store/client/grpc/GrpcStoreNodeSessionImpl.java index d2615afc0..afa831573 100644 --- a/hg-store-client/src/main/java/org/apache/hugegraph/store/client/grpc/GrpcStoreNodeSessionImpl.java +++ b/hg-store-client/src/main/java/org/apache/hugegraph/store/client/grpc/GrpcStoreNodeSessionImpl.java @@ -60,8 +60,9 @@ import lombok.extern.slf4j.Slf4j; @Slf4j @NotThreadSafe class GrpcStoreNodeSessionImpl implements HgStoreNodeSession { + private static final HgStoreClientConfig hgStoreClientConfig = HgStoreClientConfig.of(); - private static final ConcurrentHashMap tables = new ConcurrentHashMap() {{ + private static final ConcurrentHashMap tables = new ConcurrentHashMap<>() {{ put("unknown", 0); put("g+v", 1); put("g+oe", 2); @@ -87,7 +88,6 @@ class GrpcStoreNodeSessionImpl implements HgStoreNodeSession { HgStoreNodeManager nodeManager, GrpcStoreSessionClient sessionClient, GrpcStoreStreamClient streamClient) { - HgAssert.isFalse(HgAssert.isInvalid(graphName), "the argument: graphName is invalid."); HgAssert.isFalse(nodeManager == null, "the argument: nodeManager is null."); HgAssert.isFalse(storeNode == null, "the argument: storeNode is null."); @@ -102,7 +102,6 @@ class GrpcStoreNodeSessionImpl implements HgStoreNodeSession { this.notifier = new NotifyingExecutor(this.graphName, this.nodeManager, this); this.switcher = SwitchingExecutor.of(); - } @Override @@ -542,7 +541,6 @@ class GrpcStoreNodeSessionImpl implements HgStoreNodeSession { @Override public String toString() { - return "storeNodeSession: {" + storeNode + ", graphName: \"" + - graphName + "\"}"; + return "storeNodeSession: {" + storeNode + ", graphName: \"" + graphName + "\"}"; } } diff --git a/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh b/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh index 6520f5b79..242c41791 100644 --- a/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh +++ b/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh @@ -34,8 +34,10 @@ LIB="$TOP/lib" LOGS="$TOP/logs" OUTPUT=${LOGS}/hugegraph-store-server.log PID_FILE="$BIN/pid" -arch=`arch` -echo "arch --> ", ${arch} +arch=$(arch) + +# TODO: repalce it with uname -a? +echo "Current arch: ", ${arch} #if [[ $arch =~ "aarch64" ]];then # export LD_PRELOAD="$TOP/bin/libjemalloc_aarch64.so" #else @@ -43,9 +45,12 @@ export LD_PRELOAD="$TOP/bin/libjemalloc.so" #fi ##pd/store max user processes, ulimit -u -export PROC_LIMITN=20480 +# Reduce the maximum number of processes that can be opened by a normal dev/user +export PROC_LIMITN=1024 +#export PROC_LIMITN=20480 ##pd/store open files, ulimit -n -export FILE_LIMITN=1024000 +export FILE_LIMITN=1024 +#export FILE_LIMITN=1024000 function check_evn_limit() { local limit_check=$(ulimit -n) @@ -87,15 +92,15 @@ done . "$BIN"/util.sh -mkdir -p ${LOGS} +mkdir -p "${LOGS}" -# The maximum and minium heap memory that service can use -MAX_MEM=$((36 * 1024)) -MIN_MEM=$((36 * 1024)) +# The maximum and minimum heap memory that service can use (for production env set it 36GB) +MAX_MEM=$((2 * 1024)) +MIN_MEM=$((1 * 512)) EXPECT_JDK_VERSION=11 # Change to $BIN's parent -cd ${TOP} +cd ${TOP} || exit # Find Java if [ "$JAVA_HOME" = "" ]; then @@ -149,9 +154,10 @@ if [ $(ps -ef|grep -v grep| grep java|grep -cE ${CONF}) -ne 0 ]; then exit 0 fi -echo "Starting HugeGraphStoreServer..." +echo "Starting HG-StoreServer..." -exec ${JAVA} ${JVM_OPTIONS} ${JAVA_OPTIONS} -jar -Dspring.config.location=${CONF}/application.yml \ +exec ${JAVA} -Dname="HugeGraphStore" ${JVM_OPTIONS} ${JAVA_OPTIONS} -jar \ + -Dspring.config.location=${CONF}/application.yml \ ${LIB}/hugegraph-store-*.jar >> ${OUTPUT} 2>&1 & PID="$!" diff --git a/hg-store-dist/src/assembly/static/bin/stop-hugegraph-store.sh b/hg-store-dist/src/assembly/static/bin/stop-hugegraph-store.sh index e830b437d..50d6ec9ec 100644 --- a/hg-store-dist/src/assembly/static/bin/stop-hugegraph-store.sh +++ b/hg-store-dist/src/assembly/static/bin/stop-hugegraph-store.sh @@ -27,7 +27,7 @@ abs_path() { echo "$( cd -P "$( dirname "$SOURCE" )" && pwd )" } -BIN=`abs_path` +BIN=$(abs_path) TOP="$(cd $BIN/../ && pwd)" . "$BIN"/util.sh