Mod proxy l.jpg
This presentation is the property of its rightful owner.
Sponsored Links
1 / 38

mod_proxy PowerPoint PPT Presentation


  • 536 Views
  • Updated On :
  • Presentation posted in: General

mod_proxy. Clustering and load balancing with Apache 2.2 mod_proxy. Agenda. Proxy architecture Proxy protocols Load balancing Dynamic runtime management. Proxy architecture. Worker concept Forward worker Reverse worker Named reverse workers Balancer workers. Forward worker.

Download Presentation

mod_proxy

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Mod proxy l.jpg

mod_proxy

Clustering and load balancingwith Apache 2.2 mod_proxy


Agenda l.jpg

Agenda

  • Proxy architecture

  • Proxy protocols

  • Load balancing

  • Dynamic runtime management


Proxy architecture l.jpg

Proxy architecture

  • Worker concept

    • Forward worker

    • Reverse worker

    • Named reverse workers

    • Balancer workers


Forward worker l.jpg

Forward worker

  • Standard mod_proxy forward proxying

  • Enabled globally or per vhost withProxyRequests On

  • Fixed connection pool size

    • Single on prefork_mpm

    • ThreadsPerChild on worker_mpm


Reverse worker l.jpg

Reverse worker

  • Single global worker

  • Enabled by default

  • Fixed connection pool size

    • Single on prefork_mpm

    • ThreadsPerChild on worker_mpm

  • Used for unknown reverse proxy requestsfrom mod_rewrite


Named reverse workers l.jpg

Named reverse workers

  • Created for each uniquehostname:port ProxyPass directive

  • Created for each uniquehostname:port BalancerMember directive

  • Dynamic connection pool size forthreaded mpm’s.

    • Defaults to ThreadsPerChild


Balancer workers l.jpg

Balancer workers

  • Virtual worker

  • Contain 1…n real protocol workers

    LoadModule balancer_module

    modules/mod_proxy_balancer.so

    <Proxy balancer://cluster>

    BalancerMember http://remote:port

    </Proxy>


Proxy architecture8 l.jpg

Proxy architecture

  • Shared memory runtime data

Scoreboard

Listener Socket

Childprocess

Parent process

  • Worker #1

  • status

  • elected

  • read

  • transferred

Worker #1

Worker #2

Worker #n

Child process

Worker #2

Worker #1

User

Worker #n

Worker #2

Worker #n


Proxy architecture9 l.jpg

Proxy architecture

JSESSIONID=XXX.A

  • Session affinity

Tomcat/host1

jvmRoute=“A”

AJP/1.3

ajp://host1:8009 route=A

AJP13

Tomcat/host2

jvmRoute=“B”

AJP/1.3

ajp://host1:8009 route=B

AJP13

<Proxy balancer://cluster> BalancerMember ajp://host1:8009 route=A

BalancerMember ajp://host2:8009 route=B</Proxy>


Proxy architecture10 l.jpg

Proxy architecture

  • Sticky sessions


Proxy protocols l.jpg

Proxy Protocols

  • http/https

  • connect

  • ftp

  • ajp

  • balancer


Ajp protocol l.jpg

AJP Protocol

  • Apache Java Protocol

    • Current version 1.3 (AJP13)

    • Binary http protocol

    • No need to marshal/unmarshal http request

    • Reusable connections

    • Supported by most Java app servers

      • Tomcat

      • Jetty

        http://jakarta.apache.org/tomcat/connectors-doc/common/ajpv13a.html


Ajp 1 4 protocol l.jpg

AJP 1.4 Protocol

  • Next generation AJP protocol

    • Encryption

    • Compression

    • Feedback from remote node

      • Too busy

      • Going to shutdown

      • Change dynamic config

      • Update load balancer factor

  • Q4 2005


Load balancing l.jpg

Load Balancing

  • mod_proxy_balancer.so

  • Protocol independent

  • Multiple strategy

    • Request

    • Traffic

  • Session affinity

  • Failover


Load balancing15 l.jpg

Load Balancing

  • BalancerMember

    • Protocol worker to remote

    • Multiple protocols

    • Session affinity (Sticky sessions)

    • Preferred failover node


Balancer parameters l.jpg

Balancer Parameters

<Proxy balancer://cluster param=value .. >

</Proxy>

..

ProxySet balancer://cluster param=value


Stickysession l.jpg

stickysession

  • Check for session mark at the end of session identifier.

  • Configurable session identifier name

    • stickysession=JSESSIONID

    • stickysession=PHPSESSIONID

      JSESSIONID=827BFE8CB4E01BCEAE41D02042485F05.SESSIONMARK


Nofailover l.jpg

nofailover

  • Failover by default

    • nofailover=On

      • Disables failover

  • Bound to remote until expired

    • Enables removing nodes from cluster


Lbmethod l.jpg

lbmethod

  • Defines balancer strategy

    • lbmethod=Request

      • Default strategy

      • Counts number of requests to remote

    • lbmethod=Traffic

      • Default strategy

      • Counts number of bytes read/transferred


Timeout l.jpg

timeout

  • Maximum time to wait for a free connection in seconds

    • All workers are in error state

    • All workers are busy

    • Only for threaded mpm’s.

    • Limiting the number of opened connection to remote


Maxattempts l.jpg

maxattempts

  • Maximum number of failover attempts

    • Defaults to number of members

    • maxattempts=1

      • No failover


Worker parameters l.jpg

Worker Parameters

ProxyPass http://host param=value ..

BalancerMember ajp://host param=value ..

..

ProxySet http://cluster param=value


Loadfactor l.jpg

loadfactor

  • loadfactor=1

    • Normalized load factor

    • Used with BalancerMember

      loadfactor=1

      loadfactor=2

      Same as:

      loadfactor=3

      loadfactor=6


Retry l.jpg

retry

  • Number of seconds to retry the worker

  • Default is 60 seconds.


Connection pool tuning l.jpg

Connection pool tuning

  • min

    • Initial number of connections to remote

  • max

    • Maximum number of connections to remote

  • smax

    • connections to remote that will not be destroyed

  • ttl

    • destroy all the connections that exceed the smax


Keepalive l.jpg

keepalive

  • keepalive=On

    • Send SO_KEEPALIVE

    • Useful if remote is behind firewall


Timeout27 l.jpg

timeout

  • Connection timeout in seconds

    • Defaults to ServerTimeout


Route l.jpg

route

  • Session route name

    • Match with jvmRoute in Tomcat

      route=someName

      ..

      <Engine .. jvmRoute=“someName” />


Redirect l.jpg

redirect

  • Preferred failover

    • If session route worker is in error state

      BalancerMember .. route=A redirect=B

      ..

      BalancerMember .. route=B


Dynamic runtime management l.jpg

Dynamic runtime management

  • Runtime status

    • Hook for status_module

  • Balancer manager

    • Web page management


Runtime status l.jpg

Runtime status

LoadModule status_module ..

..

<Location /server-status>

SetHandler server-status

Order deny,allow

Deny from all

Allow from localhost

</Location>

..

ProxyStatus On


Runtime status32 l.jpg

Runtimestatus


Balancer manager l.jpg

Balancer Manager

  • Dynamic management of balancer

  • Management of balancer members


Balancer manager34 l.jpg

Balancer Manager

LoadModule proxy_balancer_module ..

..

<Location /manager>

SetHandler balancer-manager

Order deny,allow

Deny from all

Allow from localhost

</Location>


Slide37 l.jpg

Q&A


Thank you mladen turk mturk@apache org l.jpg

Thank youMladen [email protected]


  • Login