Passa ai contenuti principali

Post

Visualizzazione dei post con l'etichetta configuration

How to configure Tomcat JVM parameters

How to increase JVM size in Tomcat In order to change the JVM heap size for Tomcat, we need to pickup the catalina.sh/catalina.bat file and modify the value for the JAVA_OPTS parameter. For example, suppose we want to change the max heap size from 256 MB to 512 MB while setting the Perm Gen = 256 MB. Here's how to modify the JAVA_OPTS : JAVA_OPTS= "-Xms128m -Xmx512m -XX:MaxPermSize=256m" The changes in the JVM settings will take effect on the server restart. You can verify the change done in the JVM parameter by running the jmap command that is part of the JDK distribution. This tool requires passing the processId of Tomcat. Example: C:\Users\tomcat>jmap -heap 3860 Attaching to process ID 3860, please wait... Debugger attached successfully. Server compiler detected. JVM version is 24.51-b03 using thread-local object allocation. Parallel GC with 4 thread(s) Heap Configuration:    MinHeapFreeRatio = 40    MaxHeapFreeRatio = 70    M...

Tomcat configuration files

A Tomcat distribution contains the following configuration files which are necessary for proper administration of the Web server. Let's see in detail each file: catalina.policy : This file contains the security policy permissions for Tomcat 7. It enforces the security policy permissions by JVM on the web application. catalina.properties : This file describes the shared definition of the server, shared loader, and JARs, which need to be scanned at the time of the server startup. server.xml : This is the main configuration file for Tomcat and it mainly contains the Connector port configuration. It holds critical information, such as the IP address, port, virtual host, context path, and so on. tomcat-users.xml : This file is used for authentication, authorization, and role-based definitions. It is used to implement a database of users/passwords/roles for authentication and container-managed security. To add/remove users or assign/unassign roles to existing users, e...

Tomcat users configuration

Configuring Tomcat users is required in order to be able to use Tomcat Manager application. The main configuration file for tomcat users is tomcat-users.xml that resides in the conf folder of Tomcat 7. In this file, user roles and their authentication are configured. Here is for example how to configure it to add one user named tomcat that has all roles required to manage the manager GUI application and the Manager script shell:

tomcat connectiontimeout configuration

Apache tomcat contains a connectionTimeout parameter which defines the amount of time Tomcat will wait for three things: The total amount of time it takes to receive an HTTP GET request. The total amount of time between receipt of TCP packets on a POST or PUT request. The total amount of time between ACKs on transmissions of TCP packets in responses. Changing the connectionTimeout In some cases it might be necessary to increase it especially if the response takes too much to be completed on the server, leaving the connection without a response. To increase the connection timeout on tomcat server follow the following steps : 1. Open the file server.xml residing in TOMCAT_HOME/conf/. 2. Set the variable connectionTimeout in it to Value in Milliseconds.(i.e 1000 milliseconds = 1 second) For example : If  connectionTimeout  is not defined, the default value is 60000 (i.e. 60 seconds); however the standard server.xml that ships with Tomcat sets this to 2...

Tomcat Thread Pool configuration

In order to accept incoming requests, Tomcat uses a Thread pool. You can configure two types of Thread Pools: Shared Pool and Dedicated Pool . A Shared pool as the name inplies, can be shared among various components in Tomcat. So, for example if you have three connectors in your configuration, then you can use a single shared pool to serve requests for all of them. Here is how to configure a shared thread pool: Open Tomcat's server.xml file and include the Executor definition: namePrefix="catalina-exec-" maxThreads="150" minSpareThreads="4"/> Once you have added the shared thread pool, you need to reference it in your Connector configuration as follows: namePrefix="catalina-exec-" maxThreads="200" minSpareThreads="4"/> A Dedicated thread pool is a thread pool which is dedicated to only one connector definition. You can use it in a scenario when you are expecting a peak of connections and y...

Tomcat Datasource configuration using MySQL

Configuring a MySQL Datasource on Tomcat  Pre-requisite . Download MySQL JDBC Driver from: https://dev.mysql.com/downloads/connector/j/ In order to configure a Datasource on Tomcat for MySQL Database you need to follow these three simple steps: 1) Define the Datasource in server.xml Include a Datasource configuration in your Tomcat's server.xml file within the Context section, containing information about the JDBC URL, username and password and the maximum number of active connections allowed in the pool: < Resource name= " jdbc/MySQLDS " auth= " Container " type= " javax.sql.DataSource " username= " root " password= " admin " driverClassName= " com.mysql.jdbc.Driver " url= " jdbc:mysql://localhost:3306/schema " maxActive= " 15 " maxIdle= " 7 " defaultTransactionIsolation= " READ_COMMITTED " ...

Tomcat Datasource configuration using Oracle

Pre-requisite. Download Oracle JDBC Driver from: Oracle JDBC Drivers are available at Oracle Site: http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html In order to configure a Datasource on Tomcat for Oracle Database you need to follow these three simple steps: 1) Define the Datasource in server.xml Include a Datasource configuration in your Tomcat's server.xml file within the Context section, containing information about the JDBC URL, username and password and the maximum number of active connections allowed in the pool: < Resource name= " jdbc/OracleDS " auth= " Container " type= " javax.sql.DataSource " username= " scott " password= " tiger " driverClassName= " com.mysql.jdbc.Driver " url= " jdbc:oracle:thin:@localhost:1521:test " maxActive= " 15 " maxIdle= " 7 " defaultTrans...

Tomcat maxThreads configuration

Tomcat maxThreads represents the maximum number of request processing threads to be created by the HTTPConnector. < Connector port= " 8443 " protocol= " org.apache.coyote.http11.Http11Protocol " maxThreads= " 250 " SSLEnabled= " true " scheme= " https " secure= " true " clientAuth= " false " sslProtocol= " TLS " connectiontimeout= " 20000 " /> This determines the maximum number of simultaneous requests that can be handled. If not specified, this attribute is set to the default value of 200. How the process works: At server startup, the HTTP Connector will create a number of processing threads based on the value configured for the minSpareThreads attribute. Each incoming request requires a thread for the duration of that request. If the number of simultaneous requests cannot be handled by the currently available request processing threads, additio...