Apache Tomcat & Reverse Proxies



Similar documents
Apache Tomcat. Load-balancing and Clustering. Mark Thomas, 20 November Pivotal Software, Inc. All rights reserved.

Intro to Load-Balancing Tomcat with httpd and mod_jk

Agenda. Tomcat Versions Troubleshooting management Tomcat Connectors HTTP Protocal and Performance Log Tuning JVM Tuning Load balancing Tomcat

Apache Tomcat Clustering

Apache Tomcat. Tomcat Clustering: Part 2 Load balancing. Mark Thomas, 15 April Pivotal Software, Inc. All rights reserved.

Tomcat Tuning. Mark Thomas April 2009

Scaling Progress OpenEdge Appservers. Syed Irfan Pasha Principal QA Engineer Progress Software

Apache Tomcat Tuning for Production

Painless Web Proxying with Apache mod_proxy

Apache httpd v2.4: Reverse Proxy. (The Hidden Gem) Jim Jagielski

DEPLOYMENT GUIDE Version 1.0. Deploying the BIG-IP LTM with Apache Tomcat and Apache HTTP Server

EQUELLA. Clustering Configuration Guide. Version 6.2

Apache and Tomcat Clustering Configuration Table of Contents

Forward proxy server vs reverse proxy server

1. Introduction 2. Getting Started 3. Scenario 1 - Non-Replicated Cluster 4. Scenario 2 - Replicated Cluster 5. Conclusion

EQUELLA. Clustering Configuration Guide. Version 6.0

Configuring Nex-Gen Web Load Balancer

Apache HTTP Server. Load-Balancing with Apache HTTPD 2.2 and later. Erik Abele

Apache 2.2 and mod_proxy_balancer

UNICORE GATEWAY. UNICORE Team. Document Version: Component Version: Date: 19 Apr 2011

SpagoBI Tomcat Clustering Using mod_jk and httpd on Centos - In-Memory Session Replication.

Apache Tomcat Tips and Tricks from the Pros

Example Apache Server Installation for Centricity Electronic Medical Record browser & mobile access

To install and configure SSL support on Tomcat 6, you need to follow these simple steps. For more information, read the rest of this HOW-TO.

What's new in httpd 2.2?

Configuring IIS 6 to Load Balance a JBoss 4.2 Adobe LiveCycle Enterprise Suite 2 (ES2) Cluster

Pragmatic Version Control

Apache Jakarta Tomcat

NetIQ Access Manager 4.1

The course will be run on a Linux platform, but it is suitable for all UNIX based deployments.

DEPLOYMENT GUIDE. Deploying F5 for High Availability and Scalability of Microsoft Dynamics 4.0

UNICORE GATEWAY. UNICORE Team. Document Version: Component Version: Date:

Scalability and Performance with Apache 2.0

By PANKAJ SHARMA. Concepts of Server Load Balancing

How To Configure Apa Web Server For High Performance

DEPLOYMENT GUIDE. Deploying the BIG-IP LTM v9.x with Microsoft Windows Server 2008 Terminal Services

How to Integrate IIS with JBoss / Tomcat Under Windows XP and Linux

High Availability Low Dollar Load Balancing

SSL VPN Server Guide. Access Manager 3.2 SP2. June 2013

Deployment and Monitoring. Pascal Robert MacTI

Load Balancing Web Applications

Managing Virtual Servers

Service Manager and the Heartbleed Vulnerability (CVE )

Setting Up B2B Data Exchange for High Availability in an Active/Active Configuration

Integration Guide. SafeNet Authentication Service. Oracle Secure Desktop Using SAS RADIUS OTP Authentication

ZEN LOAD BALANCER EE v3.04 DATASHEET The Load Balancing made easy

Performance Optimization of Teaching Web Application based SSH Framework

DEPLOYMENT GUIDE DEPLOYING F5 WITH VMWARE VIRTUAL DESKTOP INFRASTRUCTURE (VDI)

Requirements Collax Security Gateway Collax Business Server or Collax Platform Server including Collax SSL VPN module

DEPLOYMENT GUIDE Version 1.0. Deploying the BIG-IP LTM with Apache Tomcat and Apache HTTP Server

SSL VPN Server Guide Access Manager 3.1 SP5 January 2013

Configuring ActiveVOS Identity Service Using LDAP

Deploying the BIG-IP System with Oracle E-Business Suite 11i

DEPLOYMENT GUIDE DEPLOYING THE BIG-IP LTM SYSTEM WITH MICROSOFT WINDOWS SERVER 2008 TERMINAL SERVICES

ProxyCap Help. Table of contents. Configuring ProxyCap Proxy Labs

Using EMC Unisphere in a Web Browsing Environment: Browser and Security Settings to Improve the Experience

Enterprise SSL Support

CentraSite SSO with Trusted Reverse Proxy

White Paper DEPLOYING WDK APPLICATIONS ON WEBLOGIC AND APACHE WEBSERVER CLUSTER CONFIGURED FOR HIGH AVAILABILITY AND LOAD BALANCE

ZEN LOAD BALANCER EE v3.02 DATASHEET The Load Balancing made easy

High Availability CAS

mod_cluster A new httpd-based load balancer Brian Stansberry JBoss, a division of Red Hat

INCREASE SYSTEM AVAILABILITY BY LEVERAGING APACHE TOMCAT CLUSTERING

SSL Considerations for CAS: Planning, Management, and Troubleshooting. Marvin Addison Middleware Services Virginia Tech October 13, 2010

Running Multiple Shibboleth IdP Instances on a Single Host

Content. Global Delivery Network: Folders

Creating Web Farms with Linux (Linux High Availability and Scalability)

DEPLOYMENT GUIDE Version 1.0. Deploying the BIG-IP LTM with Microsoft Windows Server 2008 R2 Remote Desktop Services

Configuring Remote HANA System Connection for SAP Cloud for Analytics via Apache HTTP Server as Reverse Proxy

Configuring Single Sign-On for Documentum Applications with RSA Access Manager Product Suite. Abstract

5Get rid of hackers and viruses for

Installation Guide for contineo

JMETER - MONITOR TEST PLAN

DEPLOYMENT GUIDE Version 1.0. Deploying the BIG-IP LTM System with VMware View

Setup Guide Access Manager 3.2 SP3

Campus VPN. Version 1.0 September 22, 2008

Brocade Virtual Traffic Manager and Magento Deployment Guide

Oracle Discoverer 4i Plus Firewall and SSL Tips. An Oracle White Paper February 2002

Access Gateway Guide Access Manager 4.0 SP1

Design and Implementation of Web Forward Proxy with

Apache Server Implementation Guide

DEPLOYMENT GUIDE Version 1.1. Deploying F5 with Oracle Application Server 10g

Testing New Applications In The DMZ Using VMware ESX. Ivan Dell Era Software Engineer IBM

Implementation of Web Application Firewall

DEPLOYMENT GUIDE DEPLOYING F5 WITH SAP NETWEAVER AND ENTERPRISE SOA

Learning GlassFish for Tomcat Users

FileMaker Server 10. Getting Started Guide

Crawl Proxy Installation and Configuration Guide

Portal In Anger. Ray Ploski Team Lead - Solutions Architecture, JBoss by Red Hat June 22, 2010

Filr 2.0 Administration Guide. April 2016

Setting Up CAS with Ofbiz 5

bbc Adobe LiveCycle Data Services Using the F5 BIG-IP LTM Introduction APPLIES TO CONTENTS

DEPLOYMENT GUIDE Version 1.1. Deploying the BIG-IP LTM v10 with Citrix Presentation Server 4.5

Repeater. BrowserStack Local. browserstack.com 1. BrowserStack Local makes a REST call using the user s access key to browserstack.

RED HAT SOFTWARE COLLECTIONS BRIDGING DEVELOPMENT AGILITY AND PRODUCTION STABILITY

Welcome to Apache the number one Web server in

Step into the Future: HTML5 and its Impact on SSL VPNs

TESTING & INTEGRATION GROUP SOLUTION GUIDE

Transcription:

Apache Tomcat & Reverse Proxies Mark Thomas, Staff Engineer 2012 SpringSource, by VMware. All rights reserved

Agenda Introductions What is a reverse proxy? Protocol selection httpd module selection Connector selection Load-balancing and clustering Potential problems Questions 2

Introductions 3

Introductions Mark Thomas Apache Tomcat committer (markt) Other ASF Infrastructure team Security Commons Member Staff Engineer at VMware Tomcat Security tc Server support 4

What is a reverse proxy? 5

What is a reverse proxy H/W Load Balancer httpd instances Tomcat instances 6

Protocol selection 7

Protocol selection Two options AJP HTTP Best choice depends on circumstances No clear winner Both support persistent connections On a fast LAN or the same machine makes little difference 8

AJP Not a binary protocol Common headers and values encoded Other values in plain text Request and response bodies in plain text Request headers must fit in a single AJP message Default 8192 Max 65536 Supports passing of SSL termination information Does not directly support encryption IPSec, VPN, SSH tunnel, etc. 9

HTTP Clear text protocol Easy to read No limit on request header size Does not directly support providing SSL termination information Can be added by httpd using custom headers Can be processed by Tomcat using the SSLValve (undocumented) Supports encryption via HTTPS 10

AJP vs. HTTP If terminating SSL at httpd and you need the SSL information Use AJP If you need to encrypt the httpd to Tomcat channel Use HTTP If you need both Use HTTP It is (usually) easier to pass SSL information over HTTP than it is to encrypt AJP If you need neither Pick the one you are more familiar with debugging problems will be easier 11

httpd module selection 12

httpd module selection Avoid mod_jk2 mod_jserv mod_webapp anything else not explicitly mention below Consider mod_jk mod_proxy (mod_rewrite) 13

mod_rewrite You can replace most of httpd.conf with mod_rewrite directives That doesn t mean that you should It is generally more efficient to use the dedicated directive There are times (complex load balancing rules) where I ve used mod_rewrite 14

mod_jk Only supports AJP Developed by the Tomcat committers More frequent releases than httpd Features developed in mod_jk first Non-httpd style configuration More complex URL mappings are simpler to write Binaries only provided for Windows 15

mod_proxy Supports AJP and HTTP Included as standard with httpd Uses httpd style configuration More complex URL mappings are trickier to write Binaries provided for most platforms mod_proxy_ajp not quite as stable as mod_jk? 16

mod_jk vs. mod_proxy If you need the latest features mod_jk If you have complex mapping rules Consider mod_jk Not on Windows and don t want to have to compile the module mod_proxy Already using one of these Carry on. The costs of changing will probably out-weight the benefits 17

mod_jk vs. mod_proxy If you have a free choice Use mod_proxy, the configuration style will be more familiar 18

Tomcat connector selection 19

Tomcat connector selection BIO 100% Java Blocking IO NIO 100% Java non-blocking IO Waiting for next request Reading HTTP request headers SSL handshake APR/native Apache APR based native code with JNI providing non-blocking IO Waiting for next request 20

Tomcat connector selection All connectors block (or simulate blocking) during Request body read Response body write SSL BIO & NIO use JSSE APR/native uses OpenSSL OpenSSL is significantly faster Sendfile NIO and APR/native support sendfile 21

Tomcat connector selection Comet NIO and APR/native support Comet WebSocket All connectors support WebSocket httpd does not support WebSocket when acting as a reverse proxy 22

BIO vs. NIO vs. APR/native If you use SSL APR/native Stability BIO has a slight edge Scalability NIO or APR/native Need APR/native benefits but with pure Java NIO 23

Troubleshooting 24

Thread exhaustion Need to understand threading models httpd prefork MPM 1 thread per process MaxRequestWorkers processes Maximum of 1 * MaxRequestWorkers threads httpd worker MPM ServerLimit processes ThreadsPerChild threads for each process Maximum of ServerLimit * ThreadsPerChild threads Thread == concurrent request 25

Thread exhaustion Each httpd thread may create a connection to each Tomcat instance Therefore, 2 httpd instances each with 400 threads Maximum of 800 connections to each Tomcat instance The connections are NOT distributed between the Tomcat instances Connections are persistent by default Connections may have low utilization BIO requires a thread per connection BIO connector may run out of threads even when Tomcat is almost idle 26

Thread exhaustion Solutions Use NIO connector as it is non-blocking between requests Don t use persistent connections between httpd and Tomcat Ensure each Tomcat instance has >= threads than total httpd threads Example ASF Jira httpd had more threads than Tomcat Didn t take much load for Tomcat to run out of threads No component was particularly loaded Tomcat, Java, network I/O all blamed 5 second fix (to server.xml to increase the number of threads) (OK, and several minutes for Jira to restart) 27

Broken links Easiest way to create a lot of hassle for yourself ProxyPass /foo http://localhost:10180/bar Easiest way to avoid the hassle ProxyPass /foo http://localhost:10180/foo Don t change the context path What can go wrong Redirects Cookie paths Links Custom headers (e.g. Spring MVC) 28

Broken links Fixing redirects Don t change the context path ProxyPathReverse will fix some but not all HTTP headers Fixing cookie paths Don t change the context path ProxyPassReverseCookiePath /bar /foo Fixing links Don t change the context path mod_sed, mod_substitute, mod_proxy_html 29

Broken links Fixing custom headers Don t change the context path mod_headers 30

Security issues Need to be careful when terminating HTTPS at httpd Tomcat needs to know if request was received over HTTPS Sessions must not transition from HTTPS to HTTP Cookies created over HTTPS must be marked as secure mod_jk and mod_proxy_ajp just handle this mod_proxy_http does not Solutions Custom headers and the RemoteIpValve Two HTTP connectors HTTP traffic proxied to connector with secure= false HTTPS traffic proxied to connector with secure= true 31

Miscellaneous Virtual host selection ProxyPreserveHost on Client IP based security RemoteIpValve 32

Questions 33