Resin Server Configuration Guide
Resin virtual memory settings
Article category:Java programming
Show grants for root @ localhost;
Resin_home-indicates the installation directory of Resin
-Xms512m-indicates that the initial memory usage is 512 MB.
-Xmx1024m-indicates that the maximum memory usage is 1024 MB.
Resin 3.0.x in Linux: In the resin_home \ bin \ httpd. Sh file, find ARGs = this line and change it
ARGs = "-J-server-xms512m-xmx1024m"
Set the memory usage of the Java Virtual Machine.
Windows
Httpd.exe-xms512m-xmx1024m
Resin 3.1.x applies to both Linux and Windows
Location: resin_home \ conf \ resin. conf
Find the following content:
<JVM-Arg>-xmx256m </JVM-Arg>
<JVM-Arg>-xss1m </JVM-Arg>
To:
<JVM-Arg>-xms512m </JVM-Arg>
<JVM-Arg>-xmx1024m </JVM-Arg>
<JVM-Arg>-xss1m </JVM-Arg>
3. Install JDK and resin
1. Download JDK Linux, j2sdk-1_4_2_10-linux-i586.bin.
2. Download resin-2.1.17.tar.gz. Or a better version
3. Enter: j2sdk-1_4_2_10-linux-i586.bin to install successfully. It has an installation script.
4. modify the configuration file in the root directory of the user. (1) ls-A View File (2) vi. bash_profile Add: Export java_home =/home/usboss/j2sdk1.4.2 _ 10/
Note: Configuring this file is similar to configuring Windows environment variables. After modifying this file, you must log on again.
5. Tar-zxf resin-2.1.17.tar.gz can be directly decompressed.
4. Description of httpd. Sh parameter configuration
1. File Location: $ {resin30}/bin/httpd. Sh
2. ARGs = '-J-server-xms200m-xmx1024m-xloggc :. /log/GC. log-XX: maxnewsize = 256 m-XX: maxpermsize = 256 m-djava. AWT. headless = true'
(1) J-server-xms200m-xmx1024m, where-xms200m indicates the initial memory size at startup,-xmx1024m
Maximum memory usage.
(2)-XX: maxnewsize = 256 m-XX: maxpermsize = 256 M indicates the size of the permanent storage area of the memory.
(3)-djava. AWT. Headless = true solves the problem that images of Linux/Unix verification codes cannot be displayed.
3. Then, it is displayed at startup.
Java-server-Xms200m-Xmx1024m-Xloggc :. /log/gc. log-XX: MaxNewSize = 256 m-XX: MaxPermSize = 256 m-Djava. awt. headless = true-Xss1m-Dresin. home =/home/channel/external VR/resin-3.0.22-Dserver. root =/home/channel/external VR/resin-3.0.22-Djava. util. logging. manager = com. caucho. log. logManagerImpl
-Djavax. management. builder. initial = com. caucho. jmx. MBeanServerBuilderImpl com. caucho. server. resin. resin-socketwait 35303-stdout/home/channel/Alibaba VR/resin-3.0.22/log/stdout. log-stderr/home/channel/Alibaba VR/resin-3.0.22/log/stderr. l
5. How to view logs
1. You can view the output information of stdout. log in the logs directory. You can also view the logs in the log directory. Command:
Real-time information: tail-100f log file name 100 indicates that 100 rows of data are displayed.
Static history: tail-100 log file name 100 indicates that 100 rows of data are displayed.
2. stdout. log in resin/logs stores the real-time output information of the server.
3. vi commands can be used to view logs and search for other functions.
4. stderr. log indicates the log of the error message.
6. FAQs
6.1 solution: How does one configure memory, heap, and verification code display?
1. File Location: $ {resin30}/bin/httpd. sh
2. args = '-J-server-Xms200m-Xmx1024m-Xloggc :. /log/gc. log-XX: MaxNewSize = 256 m-XX: MaxPermSize = 256 m-Djava. awt. headless = true'
(1) J-server-Xms200m-Xmx1024m, where-Xms200m indicates the initial memory size at startup,-Xmx1024m
Maximum memory usage.
(2)-XX: MaxNewSize = 256 m-XX: MaxPermSize = 256 m indicates the size of the permanent storage area of the memory.
(3)-Djava. awt. headless = true solves the problem that images of linux/unix verification codes cannot be displayed.
3. Then, it is displayed at startup.
Java-server-Xms200m-Xmx1024m-Xloggc :. /log/gc. log-XX: MaxNewSize = 256 m-XX: MaxPermSize = 256 m-Djava. awt. headless = true-Xss1m-Dresin. home =/home/channel/external VR/resin-3.0.22-Dserver. root =/home/channel/external VR/resin-3.0.22-Djava. util. logging. manager = com. caucho. log. logManagerImpl
-Djavax. management. builder. initial = com. caucho. JMX. mbeanserverbuilderimpl COM. caucho. server. resin. resin-socketwait 35303-stdout/home/channel/Alibaba VR/resin-3.0.22/log/stdout. log-stderr/home/channel/Alibaba VR/resin-3.0.22/log/stderr. l
6.2 in Linux/Windows, the verification code image cannot be displayed normally?
A: Modify the location: In the resin3/bin/httpd. Sh file, in The args location, add:-djava. AWT. Headless = true
6.3 what should I do with outofmemoryerror: permgen space?
A: permgen space is called permanent generation space. It refers to the permanent storage area of the memory. outofmemoryerror: permgen space is actually out of memory. The solution must be to increase the memory. This part is used to store class and meta information. When the class is loaded, it is placed in the permgen space area, which is different from the heap area where the instance is stored, GC (garbage collection) does not perform
So if your app loads many classes, the permgen space error may occur. This error is common when the web server pre-compile the JSP.
Location: In the resin3/bin/httpd. Sh file and in The args file, add:-XX: maxnewsize = 256 m-XX: maxpermsize = 256 m
6.4 how do I configure the standard log output size and number of days?
For details, see:
Http://caucho.com/resin-3.0/config/log.xtp#Log-Levels
Find in the resin. conf file
<Log name = "" Path = "stdout:" timestamp = "[% H: % m: % S. % s]"/>
The default configuration file of the standard resin3.0 contains about 9th lines.
Modify to the following content:
Generate logs by date
<Log name = "" level = "all" Path = "log/stdout. log" timestamp = "[% H: % m: % S. % s]"
Archive-format = "policy-policm-demod.stdout.log.gz"
Rolover-period = "1 W"/>
Level Log Level: Off/severe/warning/INFO/config/FINE/finer/finest/all
Path: log/stdout. Log
Archive-format: for example, 2007-5-10.stdout.log.gz
Rolover-period log rollback method: By day (15d), by Week (1 W), by month (1 m), by hour (1 h) and so on.
Generate logs by file size
<Log name = "" level = "warning" Path = "log/stdout. log" timestamp = "[% H: % m: % S. % s]"
Archive-format = "policy-policm-demod.stdout.log.gz"
Rolover-size = "10 MB"/>
Rolover-size the size of each log file: byte (5000), KB (Kb), and MB (10 MB)
Other parameters are the same as above.
According to the log output mode of usboss, the file size may be appropriate, and the size of each log file is about 10m-20m.
6.4.1 specify the debug log
A useful technique is to enable full debug logging to track down a problem:
<Log name = ''level = 'finer' Path = 'Log/debug. Log'
Timestamp = "[% H: % m: % S. % s]"
Rolover-period = '1h' rolover-Count = '1'/>
6.4.2 log standards
|
Name |
API |
Meaning |
|
Off |
Turn Off Logging |
|
Severe |
Log. Severe ("...") |
A serious failure, likely to prevent normal Program Execution |
|
Warning |
Log. Warning ("...") |
A potential problem |
|
Info |
Log.info ("...") |
Informational messages |
|
Config |
Log. config ("...") |
Static configuration messages, meant to assist in debugging problems associated with particle configurations |
|
Fine |
Log. Fine ("...") |
Tracing information |
|
Finer |
Log. Finer ("...") |
Fairly detailed tracing message |
|
Finest |
Log. Finest ("...") |
Highly detailed tracing message |
|
All |
All messages shoshould be logged |
6.5 if there is no memory consumption or logs are written too quickly, what should I do?
A: use the top command to query the usage of all processes. If any problematic process is found, kill-9 processid.
6.6 When the out of memory process occurs, what if the deadlock process is solved?
A: First, use PS-Ef | grep Java to view the process commands and system memory usage. If a deadlock process exists, kill-9 PID to kill it and restart it. If the system memory is small, you can adjust the parameters in $ resion_home/bin/httpd. Sh.
6.7 when resin is started, how do I specify the Java memory size?
1. Memory settings in window:-J "-server-xms500m-xmx1000m"
2. Linux configuration: ARGs in resin3/bin/httpd. Sh.
6.8 after the specified Java Process is killed, resin automatically restarts. How can this problem be solved?
A: The httpd. Sh file contains a Perl script that is automatically restarted. You can use PS-Ef | grep Java to find out who is calling the Java Process, and find out who is calling Java by using PS-Ef | grep Perl, kill the Perl process first. Then kill the Java Process.
6.9 check whether resin is automatically restarted?
A: httpd. Sh-h, one of which is-no-auto-restart: Disable Automatic server restart. By default, this parameter is automatically restarted. You can specify this parameter so that resin does not restart automatically. PS-Ef | grep Perl to check whether the process is in the starting status. Whether the application is restarted or not can be set as needed. For more information, see the wrapper. pl file, search for the keepalive or auto-Restart keyword, and check its initial parameter value.
6.10 resin cannot be started. Why is it reported that Java cannot be found?
A: First, check whether Java is installed and whether it is configured in. bash_profile under the user.
Second, if the installation and configuration are correct, check whether the user is correct. If the user is using su to change the valid tive user ID and group ID to that of user. For example: su-Foo. Run the shell command: source or. bash_profile.
6.11 how do I view the command parameter explanation of resin?
A: Check the command parameters httpd. Sh-h, man httpd. Sh, vi http. Sh,
6.12 how to configure the Session Timeout?
Using session-config and session-timeout to control the number of sessions
<Web-app id = '/dir'>
<Session-config>
<! -- 2 hour timeout -->
<Session-Time Out> 120 </session-Timeout>
<Sessions-max> 4096 </session-max>
</Session-config>
</Web-app>
6.13 when resin is started normally, there are users in the DB. Is it reported that the user does not exist?
A: In resin. conf, only one <JNDI-Name> name can be configured for one Conf, and this name must be unique. Otherwise, the previous one will overwrite the previous one, so you cannot log on.
Is the system deadlocked when many connections are established in 6.14 programs?
A: The reason is that the maximum number of connections in resin. conf is too small. This can be adjusted to a relatively large value. The default value is 128 connections.
<Max-connections> configures the maximum number of open connections allowed for resin's database pool. sites can use <max-connections> to throttle the number of database connections for an overloaded server. when Max-connections is reached and
An application CILS getconnection, resin will wait
Connection-wait-time or until a connection is freed before allocating a new connection.
Default128
6.15 cannot the resin on the server start?
A: First, Check log/stderr. log to see why. For example, if Resin-2.1.17 is started with the root user, it will be stored in logs/access. log, when re-starting, when directed to access. an error will be reported when writing in the log file. Because this file is created by different users, You need to delete it first.
7. Summary and prospects
A) briefly summarize the previous knowledge.
B) Improvement in the future
8 references
1. http://caucho.com
9 terms and Appendices