Increasing incoming connection request in a queue

2014-08-03 Thread Dhaval Jaiswal
acceptCount variable:

Following is the current configuration in server.xml  I am using version. 6.

Connector port=8080 protocol=HTTP/1.1
   connectionTimeout=2
   redirectPort=8443


Resource name=jdbc/DB_NAME auth=Container type=javax.sql.DataSource
driverClassName=org.
postgresql.Driver url=jdbc:postgresql://IP:PORT/DB_NAME
username= password=
maxActive=100 maxIdle=20 maxWait=3
validationQuery=select 1 testOnBorrow=true
removeAbandoned=true removeAbandonedTimeout=120
logAbandoned=true /



Planning to add  below parameters.

maxThreads=2
acceptCount=500



The situation I got is some times i am not getting timely response from the
outsiders. In this case i need to make the bigger queue in connection pool.

As per document and forums says default queue size of acceptCount is 100.
During the time if new connection request comes in it simply refuse it.



1)

I just do not want to refuse the new connection, but want to keep that
connection in a pool. I want to make the queue size of 500 and if possible
more than that.
What is your opinion on below configuration. Will it help me. Is it going
to degrade the performance if i will increase the value of acceptCount
variable along with maxThreads.

maxThreads=2
acceptCount=500


2)

As tomcat works on FIFO (first in first out) model. Is there any way to
override the precedence of connection. I know its quite not possible.
However, in case some one has any thought on it.


Re: Increasing incoming connection request in a queue

2014-08-03 Thread André Warnier

Hi.

There are  a number of problems with your post, which make it difficult to understand 
exactly what you want to know.


Dhaval Jaiswal wrote:

acceptCount variable:

Following is the current configuration in server.xml  I am using version. 6.

Connector port=8080 protocol=HTTP/1.1
   connectionTimeout=2
   redirectPort=8443


That tag is incomplete.



Resource name=jdbc/DB_NAME auth=Container type=javax.sql.DataSource
driverClassName=org.
postgresql.Driver url=jdbc:postgresql://IP:PORT/DB_NAME
username= password=
maxActive=100 maxIdle=20 maxWait=3
validationQuery=select 1 testOnBorrow=true
removeAbandoned=true removeAbandonedTimeout=120
logAbandoned=true /




That tag is also incomplete, and it has basically nothing to do with the Connector tag 
above (nor with acceptCount or maxThreads).




Planning to add  below parameters.

maxThreads=2
acceptCount=500




Where ?



The situation I got is some times i am not getting timely response from the
outsiders.


What is the outsiders ?  The browser clients trying to get a connection to Tomcat, or 
the postgres database which you seem to be using for authentication ?


 In this case i need to make the bigger queue in connection pool.

What connection pool ?



As per document and forums says default queue size of acceptCount is 100.
During the time if new connection request comes in it simply refuse it.



That has nothing to do with any connection pool.

A new connection (from a client) will be refused if :
- all Tomcat threads of the Connector are already busy handling other requests
AND
- there are already acceptCount previous connection requests waiting for an accept in 
the accept queue of the Connector





1)

I just do not want to refuse the new connection, but want to keep that
connection in a pool. 


That does not really make sense, as a phrase.

I want to make the queue size of 500 and if possible

more than that.


Why ?


What is your opinion on below configuration. Will it help me. Is it going
to degrade the performance if i will increase the value of acceptCount
variable along with maxThreads.

maxThreads=2
acceptCount=500



These two parameters are not directly related, and each of those parameters should only be 
modified (compared to the default) in very specific circumstances.
We cannot have an opinion on whether changing one or the other will help or not, before we 
know
1) if you really have a problem now, or if you are just speculating without real facts. If 
you have a real problem, what is it ? is your Tomcat really refusing browser connections ? 
if yes, does this happen all the time, or only at specific times ?
2) what is the expected load of your server ? how many clients are expected to connect to 
your server at the same time ? how many HTTP requests are you expecting to have to process 
at the same time ? how long does it take, on average, to process one request ?
3) what are the characteristics of your server ? (how fast is the CPU, how much memory 
does it have, how much of that is available to Tomcat)


etc..

Here are some general tips :

1) the default parameters of Tomcat are set by people who know what they are doing, in a 
way that they determine is appropriate for the large majority of practical cases.
There are thousands of Tomcats which are running fine on the WWW, using these default 
parameters.  Changing them without knowing why, and without konwing exactly what effect 
they have, is more likely to make the situation worse, than improving it.


2) to determine if you need to change a parameter, and which parameter to change and how 
to change it, you need first to *measure* what is happening.


2) the acceptCount of the Connector is a parameter which relates to the TCP/IP stack of 
your machine.  Tomcat just passes this parameter to the underlying OS, when it opens the 
TCP socket which is used by this Connector.  It is the TCP/IP stack of the OS which is 
going to refuse new client connections, if the accept queue fills up.
The accept queue fills up, when Tomcat (for any of many possible reasons) cannot handle 
anymore the number of client requests which arrive over a period of time.


3) the maxThreads parameter of a Connector, represents how many threads maximum, this 
Connector can start at the same time.  Each of those threads handles one request of one 
client. So, *if you know* :

a) that it takes on average 1 second for your Tomcat (and your webapp) to 
process one request
b) that, sometimes, there can be 300 clients sending one request each to your Tomcat over 
1 second (for a total of 300 requests over the same second)


then, you would know that you need to set the maxThreads parameter to (at 
least) 300.

If processing one request takes on average 2 seconds, then if during 1 second Tomcat can 
receive 300 requests, you will need to set maxThreads higher (because at the end of this 
first second, the first 300 threads 

Tomat: 8.0.9 Question related to MySql Connection Pooling

2014-08-03 Thread Richeek Arya
Hey guys,

First of all my bad to asking the question on main page here, I did not go
through the guidelines section.

Here is my query:


I want to retry MySql queries in cases of deadlock which will be removed if
I can simply retry. I use apache tomcat jdbc pool library for mysql
connection pooling and it has concept of JdbcInterceptor objects which can
be attached to existing Connection object. I wonder how to use these
interceptors to do a query retry. How can I know if query has thrown an
exception and I should retry? I am thinking of doing something like this
but I am confused in getting the right retry logic: public class
JdbQueryRetryInterceptor extends JdbcInterceptor { private final static
Logger logger = LoggerFactory .getLogger(JdbQueryRetryInterceptor.class);
@Override public void reset(ConnectionPool parent, PooledConnection con) {
} } And I have added this interceptor in the pool properties:
p.setJdbcInterceptors(com.test.mysql.JdbQueryRetryInterceptor);
-- 
with regards,
Richeek


custom actions after accessed

2014-08-03 Thread Patcharee Thongtra

Hi,

Is it possible to have Tomcat do some custom actions after a specific 
page/file is accessed/downloaded? If so, how to?

Any suggestions are appreciated.

Patcharee

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