Resin note1

[size=medium]
<cluster-default>
<resin:import path="${__DIR__}/app-default.xml"/>
</cluster-default>
<cluster id="app-tier">
<server id="app-a" address="192.168.0.10" port="6800"/>
<server id="app-b" address="192.168.0.11" port="6800"/>
<host id="">
<web-app id="" root-directory="/var/www/htdocs"/>
</host>
</cluster>
<cluster id="web-tier">
<server id="web-a" address="192.168.0.1" port="6800">
<http port="80"/>
</server>
<proxy-cache memory-size="256M"/>
<host id="">
<resin:LoadBalance regexp="" cluster="app-tier"/>
</host>
</cluster>
1.一个resin instance代表一个cluster,只能启动一个cluster中的一个server
#bin/resin.sh -server app-a start

2.jvm
-Xss 单个线程堆栈大小值;JDK5.0以后每个线程堆栈大小为1M
-Xms 启动应用时,JVM堆空间的初始大小值
-Xmx 应用运行中,JVM堆空间的极限值,设置为总内存的80%
-Xmn 此参数硬性规定堆空间的新生代空间大小,初始值和最大值(NewSize,MaxNewSize),推荐设为堆空间大小的1/4
-XX:PermSize和-XX:MaxPermSize分别设置应用服务器启动时,永久存储区的初始大小和极限大小;在生成环境中强烈推荐将这个两个值设置为相同的值,以避免分配永久存储区的开销,具体的值可取系统"疲劳测试"获取到的永久存储区的极限值;
一个JVM虚拟机可有效管理的内存大概在5-6G左右,所以内存多的服务器分配给单个resin实例JVM过多的内存是没有意义的,可以启动多个resin实例


1.The Resin web server starts listening to HTTP requests on port 8080 and listens on port 6800 for load balancer and cluster messages.

2.Garbage collection
There are essentially two GC threads running. One is a very lightweight thread which does "little" collections primarily on the Eden (a.k.a. Young) generation of the heap. The other is the Full GC thread which traverses the entire heap when there is not enough memory left to allocate space for objects which get promoted from the Eden to the older generation(s).

If there is a memory leak or inadequate heap allocated, eventually the older generation will start to run out of room causing the Full GC thread to run (nearly) continuously. Since this process "stops the world", Resin won't be able to respond to requests and they'll start to back up.

The amount allocated for the Eden generation is the value specified with -Xmn. The amount allocated for the older generation is the value of -Xmx minus the -Xmn. Generally, you don't want the Eden to be too big or it will take too long for the GC to look through it for space that can be reclaimed.

3.Stack size
Each thread in the VM gets a stack. The stack size will limit the number of threads that you can have, too big of a stack size and you will run out of memory as each thread is allocated more memory than it needs. 2048k is an appropriate value for most situations.

-Xss the stack size for each thread
-Xss determines the size of the stack: -Xss1024k. If the stack space is too small, eventually you will see a java.lang.StackOverflowError.

Some people have reported that it is necessary to change stack size settings at the OS level for Linux. A call to ulimit may be necessary, and is usually done with a command in /etc/profile:

Limit thread stack size on Linux
unix> ulimit -s 2048

4.Monitoring the JVM
The most useful tool is jconsole.
jps and jstack are also useful


5.resin watchdog
For reliability and security, Resin servers are started and monitored by a separate Resin watchdog process. The watchdog continually checks the health of the Resin server and restarts the Resin instance if is becomes unresponsive.

The standard configuration launches one watchdog per machine which monitors all the Resin JVMs on that matchine, so most sites will not need to change any watchdog configuration.

The watchdog automatically restarts Resin if the Resin JVM ever crashes or exits. So if you want to stop Resin, you need to tell the watchdog to stop the instance, or you can stop the watchdog entirely. The watchdog is typically controlled by the resin.jar main program (ResinBoot), which has commands to start, stop, and restart Resin instances as well as reporting the watchdog status.


[/size]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值