Resin服务器

1, Resin 服务器响应时间长的问题

适当增加Resin服务器的线程数。在RESIN_HOME/conf/resin.properties里,修改如下参数:

# Throttle the number of active threads for a port
port_thread_max   : 5000
accept_thread_max : 5000
accept_thread_min : 1500
keepalive_max   : 2000 

 优化linux系统参数

 

2, Resin 服务器上多次发布前端页面后,中文乱码的问题

修改 ‘resin/conf/app-default.xml, 在’com.caucho.servlets.FileServlet‘中增加character-encoding

<servlet servlet-name="resin-file"
           servlet-class="com.caucho.servlets.FileServlet">
        <init>
		<character-encoding>UTF-8</character-encoding>
	</init>
</servlet>

 

3, Resin 服务器内存占用率高

RESIN_HOME/conf/resin.properties里的线程参数值,会影响内存占用率

# Throttle the number of active threads for a port
port_thread_max   : 5000
accept_thread_max : 5000
accept_thread_min : 1500
keepalive_max   : 2000 

 将上面4个参数值调低。

扫描二维码关注公众号,回复: 363586 查看本文章
# Throttle the number of active threads for a port
port_thread_max   : 2000
accept_thread_max : 2000
accept_thread_min : 200
keepalive_max   : 512 
  设置jvm参数
jvm_args  : -Xms2048m -Xmx2048m -XX:NewRatio=4 -XX:SurvivorRatio=4 -XX:PermSize=350m -XX:MaxPermSize=350m -Xss256K  -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:+UseFastAccessorMethods -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:-CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=70 -XX:+PrintClassHistogram -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -Xloggc:log/gc.log
 

 

4, Resin 服务器ssl设置

resin pro 版不需要下面的SSL设置。

http://wiki4.caucho.com/Setting_up_OpenSSL_with_Resin_4.0.32_on_Ubuntu_12.0.4

Setup OpenSSL with a self-signed certificate

Next let's create a openssl.cnf file in /etc/resin/keys/openssl.cnf

/etc/resin/keys/openssl.cnf

[ req ]
 default_bits            = 1024
 distinguished_name      = Caucho

[ Caucho ]
 C                      = US
 C_default              = US
 ST                     = CA
 ST_default             = CA
 L                      = San Francisco
 L_default              = San Francisco
 O                      = Caucho Tech
 O_default              = Caucho Tech
 OU                     = QA Documentation
 OU_default             = QA Documentation
 CN                     = www.caucho.com
 CN_default             = www.caucho.com
 emailAddress           = [email protected]
 emailAddress_default   = [email protected]

Next create your private key file with openssl.

$ cd /etc/resin/keys
$ pwd
/etc/resin/keys
$ sudo openssl genrsa -des3 -out myprivate.key 1024

The above generates an RSA key which can be used both for encryption and for signing.

You will be prompted for a protecting pass phrase.

Output

Generating RSA private key, 1024 bit long modulus
...++++++
..........................++++++
e is 65537 (0x10001)
Enter pass phrase for /etc/resin/myprivate.key:
Verifying - Enter pass phrase for /etc/resin/myprivate.key:

Enter in a password twice. Remember this password, you will need it later.

At this stage, just create a self-signed certificate to see if openssl is working and installed correctly.

$ sudo openssl req -config openssl.cnf -new -key myprivate.key -x509 -out my-self-signed-certificate.crt

Certificates are for public key cryptography and contain the public key. Public keys are easily derived from private keys, and this is why we created the private key first. The certificate is a file that has the organizations information and the public key.

To try this out in Resin, you just need to modify etc/resin/resin.properties as follows:
# OpenSSL certificate configuration                                             
# Keys are typically stored in the resin configuration directory.               
openssl_file : keys/my-self-signed-certificate.crt                                                 
openssl_key : keys/myprivate.key             
openssl_password : password

Just navigate to:

https://mydomain.com:8443/resin-admin/

It should all work now. The browser will complain because you are using a certificate that is not from a certificate authority. Proceed past there errors.

Q1:java.lang.IllegalStateException: Unable to find native library 'resinssl' for com.caucho.vfs.OpenSSLFactory. Resin expects to find this library in:
  (Unix) /mnt/resin/libexec64/libresinssl.so
On Unix, run ./configure --prefix=`pwd`; make; make install.

A: 在resin主目录下执行:

./configure --prefix=`pwd`; make; make install

猜你喜欢

转载自7wolfs.iteye.com/blog/2287007