Introducing Tomcat6

Embed Size (px)

Citation preview

  • 8/17/2019 Introducing Tomcat6

    1/32

    Introducing Apache Tomcat 6

    Mladen TurkRed Hat, Inc.

  • 8/17/2019 Introducing Tomcat6

    2/32

    Agenda

    •A brief history of time

    •Tomcat versions

    •Tomcat 6

  • 8/17/2019 Introducing Tomcat6

    3/32

    What is Tomcat?

    •Core features–Servlet container–JSP container

    –HTTP server

    •Additional features–Native web server integration (AJP)–Basic application server features (JNDI, JDBC, …)

    –Clustering and session replication

  • 8/17/2019 Introducing Tomcat6

    4/32

    What is Tomcat?

    •Started at Sun Microsystems–Reference Java Servlet and JSP implementation–Donated to Apache Software Foundation in 1999

    •ASF TLP (Top-level Project)

    –Since 2005–Before developed under Jakarta umbrella

  • 8/17/2019 Introducing Tomcat6

    5/32

    What is Tomcat?

    • Actively developed– In average 1 release/month– 10+ active committers

    – 600.000 downloads/month (without counting mirrors)

  • 8/17/2019 Introducing Tomcat6

    6/32

    Tomcat versions

    Servlet/JSPSpec Apache Tomcat version

      2.5 2.1 6.0.x

      2.4 2.0 5.5.x  2.3 1.2 4.1.x

      2.2 1.1 3.3.x

    •Major version related to Servlet/JSP Spec–JVM required depends on the JVM required by spec

    –Spec maintained by JCP (Java Community Process)

  • 8/17/2019 Introducing Tomcat6

    7/32

    Tomcat release process

    •Follows the ASF release guidelines–Needs 3 +1 votes from the committers–When “enough” work is done

    –Release manager is volunteer

    •Urgent releases–Security related issues

    –Not discussed publicly during report-patch-release process

    –Private email list

  • 8/17/2019 Introducing Tomcat6

    8/32

    Enough Tire Kicking!

    •Can we look under the hood?

  • 8/17/2019 Introducing Tomcat6

    9/32

    Servlet 2.5 Specification

    •JSR-000154–Created via Java Community Process(http://jcp.org)

    •JSE 5.0 dependency–JDK 5.0 is minimum platform requirement

    •Allow multiple url-pattern in servlet-mapping

       OneFancyServlet 

      /foo/*   /bar/* 

       

  • 8/17/2019 Introducing Tomcat6

    10/32

    Servlet 2.5 Specification

    •Annotations support–Alternatives to some XML entries in web.xml– @Resource:

    • Class or variable “resource injection” request

    – @Resources:

    • Similar as@Resource

     but holds the array or@Resourceannotations

    – @RunAs:

    • Used to replace   entries in web.xml

    – @eclareRoles:

    • Alternative to   in web.xml

    –Come from JSR 250 (Common Annotations for the Java Platform)

  • 8/17/2019 Introducing Tomcat6

    11/32

    Tomcat 6 Source

    •Restructured code base–No multiple repositories–Reduced duplicate code

    –Removed obsolete items

    –Reduced distribution size

  • 8/17/2019 Introducing Tomcat6

    12/32

    Tomcat 6 Distribution

    •Restructured distribution

    – /server/* and/s!are"/* are gone!

    – /lib/* location of common libraries

    –Windows service wrapper for WIN64(EMT64 and IA64)

    –Reduced distribution size

  • 8/17/2019 Introducing Tomcat6

    13/32

    Tomcat 6 Distribution

    •Additional components–Downloadable from/e#tras/*

    •Full commons-logging implementation–Tomcat uses a package renamedcommons-logging

    API implementation which is hard-coded to use the$ava%util%logging API.

    •Web Services support (JSR 109)–Tomcat provides factories for JSR 109 which may be used to resolveweb services references.Place the generatedcatalina-&s%$ar as well as$a#rpc%$ar

    and &s"l'$%$ar (or another implementation of JSR 109)in the Tomcat/lib/ folder.

  • 8/17/2019 Introducing Tomcat6

    14/32

    Tomcat 6 Distribution

    •Windows Installer–Installs and setup the Tomcat as a Windows service–Optionally download nativetcnative-(%"ll component

    located at!eanet%ie

  • 8/17/2019 Introducing Tomcat6

    15/32

    Running Tomcat 6

    •Use provided OS mechanism–On Windows usetomcat)%e#e andtomcat)&%e#e–The famous%/catalina%s! run

  • 8/17/2019 Introducing Tomcat6

    16/32

    Running Tomcat 6

    •APR was not found message

    –Fallbacks automatically to the standard Java IO implementation

  • 8/17/2019 Introducing Tomcat6

    17/32

    Running with APR

    •Uses Tomcat Native (tcnative)–Wrapper over Apache Portable Runtime (APR)–Replaces common JSE network stack

  • 8/17/2019 Introducing Tomcat6

    18/32

    Running with APR

    •Build or download native package–Needs to be in+,RAR.+A01 orA01 on Windows

  • 8/17/2019 Introducing Tomcat6

    19/32

    How Native works

    •The traditional model is Thread per connection–Each client is assigned one thread during the connection lifetime.

  • 8/17/2019 Introducing Tomcat6

    20/32

    How Native works

    •Uses Thread per request–During KeepAlive thread is assigned to next client

  • 8/17/2019 Introducing Tomcat6

    21/32

    How native works

    •Higher concurrency–Able to handle 10000+ concurrent clients

  • 8/17/2019 Introducing Tomcat6

    22/32

    How native works

    •Sendfile support–Uses OS feature for zero-copy.

  • 8/17/2019 Introducing Tomcat6

    23/32

    The benefits of using Native

    •Performance–Uses zero-copy for static content

    –Uses OpenSSL instead JSSE

    –Zero GC – no Java objects are created

    •Scalability–Thread per request allows more HTTP/1.1 concurrent connections

    –Lower CPU and memory usage

  • 8/17/2019 Introducing Tomcat6

    24/32

    Some numbers

    •50 concurrent users–Log scale: zoom on 4MB file serving

    160 Req/Sec

    60 Req/Sec

  • 8/17/2019 Introducing Tomcat6

    25/32

    Some numbers

    •Sendfile lowers down the memory and CPU usage

  • 8/17/2019 Introducing Tomcat6

    26/32

    Tomcat Manager

  • 8/17/2019 Introducing Tomcat6

    27/32

    Tomcat NIO Connector

    •Developed on APR principles–Use JSE NIO features

    –No need for extra native package

    –Not for static content delivery and SSL

    •Allows thread per connection model–Something NIO wasn’t designed for–Extends the standard blocking Servlet model

  • 8/17/2019 Introducing Tomcat6

    28/32

    Tomcat Advanced IO

    •The Comet–Process servlets asynchronously!

    –Receive events when data is available for reading on the connection.

    –Not usable with AJP (for now)

  • 8/17/2019 Introducing Tomcat6

    29/32

    Comet events

    •The Servlet is awaken on event–Implement theorg%apac!e%catalina%2ometrocessor interface

    –The servlet is valid until the34 event

    •BEGIN–Called at the beginning of the processing of the connection.

    –Valid until the34 or3RROR  events.

    •READ–Indicates that input data is available.

    –It is not allowed to attempt reading data from the requestobject outside of the execution of this method.

    •END–Indicates the end of the processing

    –Can be fired by application reload

  • 8/17/2019 Introducing Tomcat6

    30/32

    Tomcat 6

    •Documentation

    –http://tomcat.apache.org/tomcat-6.0-doc/

    •Download

    –http://tomcat.apache.org/download-60.cgi

    •Support

    –Tomcat users mailing listhttp://tomcat.apache.org/lists.html

    •Bug database–We don’t make bugs but anyhow …

    –http://tomcat.apache.org/bugreport.html

    http://tomcat.apache.org/tomcat-6.0-doc/http://tomcat.apache.org/download-60.cgihttp://tomcat.apache.org/lists.htmlhttp://tomcat.apache.org/bugreport.htmlhttp://tomcat.apache.org/bugreport.htmlhttp://tomcat.apache.org/lists.htmlhttp://tomcat.apache.org/download-60.cgihttp://tomcat.apache.org/tomcat-6.0-doc/

  • 8/17/2019 Introducing Tomcat6

    31/32

    Q & A

  • 8/17/2019 Introducing Tomcat6

    32/32

    This page intentionally left blank

    Mladen Turk