On Aug 13, 2013, at 11:37 AM, "Smith, Mitchell" <mitchell.sm...@cwc.com> wrote:

> Dan,
> 
> I am currently developing/testing with the latest version: 7.0.42

Excellent!

> *Note this is different than the configuration you specified above, which
> appears like it's trying to restrict the number of sessions that the
> manager will create*
> Yes, maxActiveSessions is the parameter I am using. As I know the memory
> footprint of a session in the application I have set the parameter to the
> number of sessions I would support per application instance. Thus ensuring
> that an instance is not overloaded by sessions.

Since sessions are your limiting factor, you might want to look at using 
mod_jk.  It has a couple load balancing algorithms based on session count, 
which might make this easier for you.  

See the "method" directive here.  
http://tomcat.apache.org/connectors-doc/reference/workers.html

> My idea is based on the understanding that I have a fixed user base, and my
> infrastructure is designed to scale for this user base. The issue occurs if
> the LB fails to balance (for what ever reason), the tomcat instance could
> block new sessions and pass the user to a static (helpful) error page
> and/or redirect them back to the base URL of the LB.

You should probably look at what is going on with your load balancer.  If a 
request fails, the load balancer should notice and temporarily take the Tomcat 
instance out of the load balancing group.  Are you using mod_proxy or mod_jk?  
Can you share your load balancer configuration?

> What I am struggling is the ability to catch the IllegalStateException that
> would be thrown by the Manager, and forward to the error/redirect as a
> result of this.

How are you trying to catch this?  In the application?  With a filter?

Dan

> 
> 
> 
> On 13 August 2013 15:18, Daniel Mikusa <dmik...@gopivotal.com> wrote:
> 
>> On Aug 13, 2013, at 9:33 AM, "Smith, Mitchell" <mitchell.sm...@cwc.com>
>> wrote:
>> 
>>> On 13 August 2013 13:24, Daniel Mikusa <dmik...@gopivotal.com> wrote:
>>> 
>>>> On Aug 13, 2013, at 6:43 AM, "Smith, Mitchell" <mitchell.sm...@cwc.com>
>>>> wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>> 
>>>> What version of Tomcat are you using?  6.0.x or 7.0.x?
>>>> 
>>> Tomcat7
>> 
>> Please include the complete version number.  There are 42 different Tomcat
>> 7 releases.  The more specific you can be the better response you'll get
>> from the list.
>> 
>>> 
>>>> 
>>>>> I was looking at using the maxActiveConnections in the application
>>>> context,
>>>> 
>>>> Please include the relevant configuration from your server.xml or
>>>> context.xml file.
>>>> 
>>> Context.xml
>>> 
>>>> <Context>
>>>> 
>>>>   <!-- Default set of monitored resources -->
>>>> 
>>>>   <WatchedResource>WEB-INF/web.xml</WatchedResource>
>>>> 
>>>>   <!-- Uncomment this to disable session persistence across Tomcat
>>>> restarts -->
>>>> 
>>>>   <Manager pathname=""
>>>>    *maxActiveConnections="150"
>> 
>> Are you referring to "maxActiveSessions"?
>> 
>>   https://tomcat.apache.org/tomcat-7.0-doc/config/manager.html
>> 
>>>> */>
>>>>   <!-- Uncomment this to enable Comet connection tacking (provides
>> events
>>>>        on session expiration as well as webapp lifecycle) -->
>>>>   <!--
>>>>   <Valve
>>>> className="org.apache.catalina.valves.CometConnectionManagerValve" />
>>>>   -->
>>>> </Context>
>>>> 
>>>> 
>>>>> what I find is. When I reach the limit, as expected the server will not
>>>>> create a new session, however does return a http 200 status code.
>>>>> 
>>>>> I am wondering would it be possible for me to change this behavior to
>>>>> return say a 300 range code to redirect to (in a production
>> environment)
>>>>> load balancer.
>>>>> 
>>>>> I can see some potential issues with this, like the possibility of an
>>>>> infinite loop, but for now I am just exploring possible ways to prevent
>>>> my
>>>>> tomcat servers becoming overloaded.
>>>> 
>>>> How do you have your load balancer setup now?  What software / hardware
>>>> are you using?  What algorithm is it using to distribute the load?
>>>> 
>>> Its an apache httpd server, distributing load using byRequest, with a
>>> redundant fail-over node configured howevr this only works if the tomcat
>>> server fails to accept the initial connection
>>> 
>>>> 
>>>>> 
>>>>> Does anyone have any thoughts or ideas for this type of solution?
>>>> 
>>>> Perhaps you need to adjust the load balancer so it's spreading out the
>>>> connections more evenly?  Perhaps you need to add another node to handle
>>>> the load?
>>>> 
>>>> Its a recent issue, typical user response to a slow application (for
>>> whatever reason) is to open another session, however the jvmRoute is
>> stored
>>> in the browser which forces the 2nd,3rd,4th.... session to the same host.
>>> 
>>> We are looking at a application solution to provide a new session without
>>> the jvmRoute in separate tabs, but the ability to reject and redirect a
>>> user (even to a error page) when the server limit we set is reached would
>>> prevent a larger scale outage.
>> 
>> You might try "maxConnections" on the HTTP connector.
>> 
>>   https://tomcat.apache.org/tomcat-7.0-doc/config/http.html
>> 
>> or the AJP connector, depending on how your proxy is connecting to Tomcat.
>> 
>>   https://tomcat.apache.org/tomcat-7.0-doc/config/ajp.html
>> 
>> "The maximum number of connections that the server will accept and process
>> at any given time. When this number has been reached, the server will not
>> accept any more connections until the number of connections falls below
>> this value."
>> 
>> Note this is different than the configuration you specified above, which
>> appears like it's trying to restrict the number of sessions that the
>> manager will create.
>> 
>> Dan
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>> 
>> 
> 
> 
> -- 
> *Mitchell Smith
> *
> Developer
> *Cable & Wireless Communications*
> Tel: +44 (0) 20 7315 4454
> Mobile: +44 (0) 7921619263
> www.cwc.com
> 
> The information contained in this email (and any attachments) is confidential 
> and may be privileged. If you are not the intended recipient
> and have received this email in error, please notify the sender immediately 
> by reply email and delete the message and any attachments.
> If you are not the named addressee, you must not copy, disclose, forward or 
> otherwise use the information contained in this email.
> Cable & Wireless Communications Plc and its affiliates reserve the right to 
> monitor all email communications through their networks to
> ensure regulatory compliance.
> 
> Cable & Wireless Communications Plc is a company registered in England & 
> Wales with number:
> 07130199 and offices located at 3rd Floor, 26 Red Lion Square, London WC1R 4HQ


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to