http://www.hackerschool.org/HS_Boards/zboard.php?id=Free_Lectures&no=580 [º¹»ç]
outofmemory´Â »ý¼ºµÇ´Â °´Ã¼¸¦ À§ÇØ ´õ ÀÌ»ó ÇÒ´çÇØÁÙ ¸Þ¸ð¸® °ø°£ÀÌ ¾ø´Ù´Â ÀǹÌÀε¥...
java¿¡¼ memory¸¦ ÇÒ´çÇØÁÖ´Â ³ðÀº tomcatÀ» ½ÇÇà½ÃŲ jvmÀÌÁÒ.
±×·¯¸é jvm¿¡ º¸´Ù ¸¹Àº ¸Þ¸ð¸®¸¦ Á¦°øÇÏ¸é ¹®Á¦°¡ ÇØ°áµÈ´Ù°í »ý°¢Çß¾ú½À´Ï´Ù.
jvmÀÇ ¸Þ¸ð¸® °ü¸®¿¡ °³¹ßÀÚ°¡ ¿µÇâÀ» ¹ÌÄ¥ ¼ö ÀÖ´Â °¡Àå ½¬¿î ¹æ¹ýÀº java°¡ ½ÇÇàµÉ ¶§ Xms XmxµîÀÇ ¸Þ¸ð¸® °ü·Ã ¿É¼ÇÀ» »ç¿ëÇÏ´Â °ÍÀÔ´Ï´Ù.
<´ÙÀ½Àº sun jvmÀÇ °æ¿ìÀÔ´Ï´Ù.>
¾Æ¸¶.. ¾Æ¹«·± ¿É¼ÇÀ» ÁÖÁö ¾ÊÀ¸¸é µðÆúÆ®·Î °¡¿ëÇÑ ¸Þ¸ð¸® Å©±â°¡ 128MÀΰ¡·Î ¼³Á¤ÀÌ µÇ´Âµ¥¿ä..
±×·¡¼ ¿¹¸¦ µé¸é tomcatÀÇ catalina.sh¿¡ ´ÙÀ½°ú °°Àº °ªÀ¸·Î optionÀ» Á¶Á¤ÇÏ¿´½À´Ï´Ù.
JAVA_OPTS="-Xms512m -Xmx512m -XX:PermSize=64m -XX:MaxPermSize=64m -XX:NewSize=400m -XX:MaxNewSize=400m -XX:SurvivorRatio=4 -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC"
Xms, Xmx, permsize, newsize survivorRatioµîÀÇ ¿É¼ÇÀ» ÀûÀýÈ÷ »ç¿ëÇÏ¸é ¾Æ¸¶ outofmemory ¹®Á¦¸¦ ÇØ°áÇÒ ¼ö ÀÖÀ» °ÍÀÔ´Ï´Ù. À§ÀÇ ¼ýÀÚ¼³Á¤¿¡ ´ëÇÑ °¡À̵å´Â javaservice.netÀ̳ª À¥¿¡¼ outofmemeory·Î °Ë»öÇغ¸½Ã¸é ÁÁÀº ¾ÆƼŬÀÌ ¸¹½À´Ï´Ù.
±×¸®°í À§ÀÇ ¿¹Á¦ Äڵ尡 ¹«»çÈ÷ ½ÇÇàÀ» ¸¶Ä¡°í ½ÇÇེÅÿ¡¼ ºüÁø ÈÄ¿¡ GC°¡ ¹ß»ýÇÏ¸é ¸Þ¸ð¸®°¡ ÁÙ¾îµé °Í °°³×¿ä.
¢Â ÅèĹ Èü ¸Þ¸ð¸® Á¶Á¤Çϱâ (À©µµ¿ì¿ë)
1. ( ÅèĹ ½ÇÇà ÆÄÀÏ catalina.bat ¼öÁ¤ ) catalina.bat ÆÄÀÏ ³»¿¡ ÇØ´ç ³»¿ëÀ» ÀÔ·ÂÇÑ´Ù.
set JAVA_OPTS=-server -Xms128m -Xmx128m
½ÃÀÛ > ½ÇÇà > cmd (µµ½ºÃ¢µé¾î°£ÈÄ) > catalina.bat stop ½ÇÇà
½ÃÀÛ > ½ÇÇà > cmd (µµ½ºÃ¢µé¾î°£ÈÄ) > catalina.bat start ½ÇÇà
2. ¼ºñ½º ½ÃÀÛ / Á¾·á ÆÄÀÏ»ý¼º
tomcat_start.bat ( ¼ºñ½º ½ÃÀÛ )
C:
cd C:\Program Files\Apache Group\Tomcat 4.1\bin\
catalina.bat start
tomcat_stop.bat ( ¼ºñ½º Á¾·á )
C:
cd C:\Program Files\Apache Group\Tomcat 4.1\bin\
catalina.bat stop
¢Â ÅèĹ Èü¸Þ¸ð¸® Á¶Á¤Çϱâ (¸®´ª½º¿ë)
vi ./startup.sh ( ÅèĹ ½ÇÇà ÆÄÀÏ startup.sh ¼öÁ¤ )
#!/bin/sh
# -----------------------------------------------------------------------------
# Start Script for the CATALINA Server
#
# $Id: startup.sh,v 1.2 2002/01/15 02:55:38 patrickl Exp $
# -----------------------------------------------------------------------------
# resolve links - $0 may be a softlink
PRG="$0"
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
PRGDIR=`dirname "$PRG"`
##############512m·Î °Á¦ ¼ÂÆà : START
export CATALINA_OPTS="-Djava.awt.headless=true -Xms512m -Xmx512m"
##############512m·Î °Á¦ ¼ÂÆà : END
EXECUTABLE=catalina.sh
######## ms, mx °ªÀº CPUÀÇ °¹¼ö¿Í MEMÅ©±â¿¡ µû¶ó ÀûÀýÈ÷ Á¶Á¤ÇÕ´Ï´Ù. (EX:-Xms512m -Xmx512m )
# Check that target executable exists
if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
echo "Cannot find $PRGDIR/$EXECUTABLE"
echo "This file is needed to run this program"
exit 1
fi
exec "$PRGDIR"/"$EXECUTABLE" start "$@" |
Hit : 23657 Date : 2006/12/05 07:16
|