Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!
Labels (1)
avatar
Guru

Unlike other services, Knox doesn't expose Java Heap settings via Ambari. Follow these steps to change default Heap settings for Knox:

1. On the Knox node, login as root and go to this directory: /usr/hdp/current/knox-server/bin

# cd /usr/hdp/current/knox-server/bin 

2. Make a copy of the file that we are going to change next.

# cp gateway.sh gateway.sh.backup.`date +%m%d%Y-%H-%M-%S`

3. Open gateway.sh in text editor and change this line:

APP_MEM_OPTS=""

to this:

APP_MEM_OPTS="-Xmx5g -XX:NewSize=3G -XX:MaxNewSize=3G -verbose:gc -XX:ParallelGCThreads=8 -XX:+UseConcMarkSweepGC -Xloggc:/var/log/knox/knox-gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps"

Shown above are the example values for Knox Heap. This should be updated based on user's environment.

General formula for Knox Heap size will be:

Recommended KNOX Heap Size = 
(Webhdfs(ConcNumOfRequest*(replayBufferSize)) + 
HBase(ConcNumOfRequest*(replayBufferSize)) + 
Hive(ConcNumOfRequest*(replayBufferSize))) + 20 % for request surges

where:

ConcNumOfRequest = Number of concurrent requests expected for each component (WebHDFS, HBase, Hive etc.) replayBufferSize = Size of the largest incoming request to Knox

Based on the Heap size value, user need to further tune the NewSize and MaxNewSize.

4. Save changes to gateway.sh and restart Knox via Ambari. Confirm the new settings via 'ps -ef | grep knox' command.

# ps -ef| grep gateway
knox     29236     1 93 23:18 ?        00:00:29 /usr/jdk64/jdk1.8.0_77/bin/java -Xmx5g -XX:NewSize=3G -XX:MaxNewSize=3G -verbose:gc -XX:ParallelGCThreads=8 -XX:+UseConcMarkSweepGC -Xloggc:/var/log/knox/knox-gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -jar /usr/hdp/current/knox-server/bin/gateway.jar 
4,532 Views
Version history
Last update:
‎06-02-2017 01:52 AM
Updated by:
Contributors