TomcatExpert

Developers

Ask the Experts : Apache Tomcat 7 Private byte increases and not releasing back

I have observed the tomcat 7 process memory (private bytes) was initially 1.2 GB during startup and it got increased to 3.5 GB where my server RAM size is only 4GB after running a 100 users test for 4 hours. this private bytes was not released even after stopping the test. could you please let us know any configurations that might help this or kindly analyze the situation and provide your suggestions/solutions.

Regards,

Raga

 

asked by Ragavendran

question

Lacking more specific about the behavior that you are seeing and about the environment that you are using to run your tests, and since this is a testing environment, my suggestion to you would be to run your tests while you have a profiler hooked up to Tomcat (YourKit is an excellent profiler).  The profiler will allow you to look for memory problems in your application.

That's not to say there is definitely a problem here.  It is entirely possible that you could see the heap grow from 1.2 G to 3.5G legitimately.  It just depends on your JVM options and the memory demands of your application.

answered by dmikusa on May 8, 2012 10:51 AM

Read More

answer

0 comments   |  

0
Rating
  |  

Developers, Executives | Tomcat Configuration, Tomcat Memory, YourKit

Ask the Experts : Tomcat-jdbc pooling not detecting dead connections

We recently migrated to using the apache tomcat jdbc connection pooling.

We are using v1.1.0.1 of the connection pooling mechanism with tomcat 6.0.33 on Oracle 10g

Our connection pools are configured as follows:

asked by san9jay

question

add

testOnBorrow="true"

validationQuery="select 1 from dual"

in order to validate your connections

answered by fhanik on May 10, 2012 08:39 AM

Read More

answer

1 comments   |  

0
Rating
  |  

Developers | Tomcat Configuration, tomcat jdbc connection killed detection

Blog : How Apache Tomcat Implemented WebSocket

posted by fhanik on May 1, 2012 07:13 AM

With the Apache Tomcat 7.0.27 release, the Apache Tomcat team introduced a WebSocket implementation. In a previous post, we took a look at what the WebSocket implementation means, including what benefits and limitations they present. Today, we will discuss specifically how WebSocket is implemented in Apache Tomcat 7.

Since WebSocket is a protocol sent over TCP after an initial HTTP handshake, you could effectively implement WebSocket using Tomcat’s Comet implementation. There is a back port to Tomcat 6 suggested that does exactly that with very minor changes.

The Apache Tomcat team however decided to go with a more substantial implementation with changes to the core of Tomcat’s network and protocol implementation. The reason for this was memory and scalability based. If Tomcat can recycle the HttpServletRequest/Response objects after the initial handshake, each WebSocket connection will take up less memory in the Java heap. It also opens up the Tomcat container for other future protocols that utilize the HTTP Upgrade feature.

The WebSocket implementation from an API standpoint is fairly straightforward. You really can only do two things:

  1. Send messages
  2. Receive messages

Read More

5 comments   |  

5
Rating
  |  

Developers, Operations | WebSocket, Apache Tomcat 7

Ask the Experts : Validation not triggering when deployed into Tomcat

asked by alex

question

hi Alex, welcome to the world of Java.

My recommendation is that you run without the security manager. It is inherently complex to, and it's not where you start as a beginner.

Before even consider running with the security manager turned on, you need to evaluate your requirements if you even need it. In my experience, 9 out of 10 companies will not need it as they secure the environments where Tomcat runs instead. In shared environments with untrusted parties, such as a shared hosting environment, the security manager comes in handy as it can protect against code.

So, to get started, turn off the security manager, and get your application fully working. The security manager is not a feature of Apache Tomcat, it's part of the Java Runtime Environment.

best

Filip

 

answered by fhanik on June 28, 2012 07:39 AM

Read More

answer

0 comments   |  

0
Rating
  |  

Developers |

Blog : WebSockets in Tomcat 7

posted by fhanik on April 23, 2012 10:22 PM

With the 7.0.27 release the Apache Tomcat team introduced a WebSocket implementation. WebSocket has received a lot of hype, and has been much anticipated by Tomcat users. Let’s take a quick look at what web sockets are, what benefits and limitations they have and how they are implemented in Apache Tomcat 7.

What is a WebSocket?

WebSocket is considered the next step in evolution of web communication. Over time, communication has evolved in steps to reduce the time and data throughput for the application to update a user’s browser. The evolution has looked a little like this:

  • Entire page reloads
  • Component reloads using AJAX Processing
  • Comet communication
    • Long poll– similar to AJAX, but not holding a thread on the server
    • Bi directional- two way communication over the same TCP

Each of these steps had their benefits and challenges. Apache Tomcat 6 implements bi-directional communication over HTTP using its Comet Processor. This implementation allowed for asynchronous event driven request processing as well as bi-directional communication. This implementation had a few limitations.

Read More

3 comments   |  

0
Rating
  |  

Developers | WebSocket, Apache Tomcat 7

Blog : Apache Tomcat 7.0.27 Released

posted by Stacey Schneider on April 5, 2012 01:59 PM

The Apache Tomcat team announces the immediate availability of Apache Tomcat 7.0.27

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This release is includes significant new features as well as a number of bug fixes compared to version 7.0.26. The notable changes include:

  • Support for the WebSocket protocol (RFC6455). Both streaming and message based APIs are provided and the implementation currently fully passes the Autobahn test suite. Also included are several examples.
  • A number of fixes to the HTTP NIO connector, particularly when using Comet.
  • Improve the memory leak prevention and detection code so that it works well with JVMs from IBM.

Please refer to the change log for the complete list of changes:
http://tomcat.apache.org/tomcat-7.0-doc/changelog.html

Note that this version has 4 zip binaries: a generic one and three bundled with Tomcat native binaries for Windows operating systems running on different CPU architectures.

Read More

0 comments   |  

0
Rating
  |  

Developers, Operations | nio, Tomcat 7, WebSocket

Blog : Integrating Jenkins and Apache Tomcat for Continuous Deployment

posted by jfullam on March 20, 2012 04:32 PM

Working software is the primary measure of progress for software development teams. This is one of the principles of the Agile Manifesto and has led agile software teams to focus on implementing the most important features of a system early and efficiently. These teams usually provide frequent deployments of the software in order to receive feature validation from the business and to show project progress. The benefits are quick and frequent feedback for the developers and congruous applications for the business.

The practice of automated continuous deployment ensures that the latest checked in code is deployed, running, and accessible to various roles within an organization. Project managers can have a place to check on project progress, testers have a view into the latest builds, developers can see the their modules working with the modules from other team members, and stakeholders can see how their requirements have been translated into working software. Tomcat and tc server easily integrate with continuous integration servers to allow agile teams to realize continuous deployment while utilizing a lean application server (another practice of agile teams). You can start practicing continuous deployment very quickly using Tomcat or tc server, Jenkins, and your source control system of choice.

Read More

4 comments   |  

0
Rating
  |  

Developers, Operations | Continuous Integration, Hyperic, tc Server

Blog : Apache Tomcat 7.0.26 Released

posted by Stacey Schneider on February 22, 2012 10:48 AM

The Apache Tomcat team announces the immediate availability of Apache Tomcat 7.0.26

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This release is primarily a bug fix release and includes numerous bug fixes compared to version 7.0.25. The notable bug fixes include:

  • Improved @HandlesTypes processing which no longer loads all classes on web application start.
  • Ensure that POST bodies are available for reply after FORM authentication when using the AJP connectors
  • Corrected a regression that broke annotation scanning for many use cases including web applications packaged as WARs and many embedded scenarios.

Please refer to the change log for the complete list of changes:
http://tomcat.apache.org/tomcat-7.0-doc/changelog.html

Note that this version has 4 zip binaries: a generic one and three bundled with Tomcat native binaries for Windows operating systems running on different CPU architectures.

Read More

0 comments   |  

0
Rating
  |  

Developers, Operations | Apache Tomcat 7

Ask the Experts : catalina.out log rotation

 

Hi,

I am interested in catalina.out log file rotation, I have an application where logging to catalina.out is very huge, say 0.5 MB / sec.

So I have written one script to handle this which is shown below.

 

# crontab -l | grep catalina

0,30 * * * * bash /catalina_log_handler.sh  >/dev/null 2>&1

 

# more /catalina_log_handler.sh

#!/bin/sh

CATLOC=/bin/cat

SEDLOC=/usr/bin/sed

asked by akshay_tomcat

question

The catalina.out file is created by a shell redirection, ex ">> catalina.out 2>&1".  This catches anything written to System.out and System.err and places it into the catalina.out file. 

Given this, a good way to rotate catalina.out is to alter the script to pipe the output to a log rotation script rather than directly to a file.  This will allow you to rotate the logs without restarting Tomcat and without copying the entire contents of the log to another file.

It's a pretty simple change to catalina.sh and it is described at this link.

    http://marc.info/?l=tomcat-user&m=105640876032532&w=2

 

answered by dmikusa on February 20, 2012 08:27 AM

Read More

answer

1 comments   |  

0
Rating
  |  

Developers | log rotation

Ask the Experts : BASIC Auth configuration on Tomcat 7 with https

I'm trying to setup BASIC auth on my tomcat 7 which is listening on port 80 and 443.

I have made the following changes:

In the web.xml of the web-app

asked by ronzensci

question

Your configuration looks OK to me.  I copied and pasted it into my local Tomcat 7.0.25 installation and it worked OK for both HTTP and HTTPS traffic.

One possible issue, which is very easy to test, is that your browser has your authentication credentials cached.  With BASIC auth, your browser will only prompt you for credentials the first time you authenticate to your site.  After a successful authentication, it will not prompt you again.  To force your browser to prompt you again, you'll need to completely close out the browser.

An alternative, and my personal preference for testing BASIC auth, is to use cURL.  Here are some examples of testing with cURL.

Test without credentials

To test that you resources are being protected, you can use this command to access them without credentials.  The request should return an HTTP 401 Unauthorized request and the "WWW-Authenticate" header should indicate basic authentication is required.

curl -vv https://your.domain.name/

Test with credentials

To test that authentication is working correctly, you can specify a set of credentials for authentication.  The request should be sent with an "Authorization" header and given that your credentials are valid it should authenticate.  If your credentials are invalid you should be presented with a HTTP 401 Unauthorized message.  If the user is authenticated, but does not have access to view the resource you should be presented with an HTTP 403 Forbidden message.

curl -vv -u bcsguser:password https://you.domain.name/

A couple notes about cURL. 

  • Using the "-vv" option will display additional information like the HTTP headers.  This can be helpful for debugging BASIC auth problems because you can verify that the correct headers (like "WWW-Authenticate" and "Authorization") are being properly set.
  • If you have a self-signed SSL certificate, cURL will fail with an error.  Specifying the "-k" option will tell cURL to ignore this error.

 

answered by dmikusa on September 10, 2012 07:24 AM

Read More

answer

0 comments   |  

0
Rating
  |  

Developers | basic authentication, Apache Tomcat 7

Syndicate content