You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Praveen Sripati <pr...@gmail.com> on 2010/07/16 16:56:11 UTC

Tomcat and MySQL in Azure Cloud

We are in the process of migrating Tomcat and MySQL to Microsoft Azure Cloud
and facing challenges due to the dynamic nature of the cloud like allocation
of dynamic ip and ports to the instances of Tomcat & MySQL in Azure. Because
of this behavior Tomcat needs to

1) Dynamically update the ip and ports of the different MySQL instances in
the JDBC URL (
http://dev.mysql.com/doc/refman/5.5/en/connector-j-reference-replication-connection.html).
Suppose the following is the JDBC URL, then it has to be updated in Tomcat
at run-time when a new instance of MySQL is bought up or an instance of
MySQL is bought down.

url=jdbc:mysql:replication://127.0.0.1:5104,127.0.0.1:5108,127.0.0.1:5112,
127.0.0.1:5116,127.0.0.1:5116/itops

2) We are using DBCP (http://commons.apache.org/dbcp/) for connection
pooling. Similarly when a new instance of MySQL is bought up or an instance
of MySQL is bought down the pool has to be updated dynamically accordingly
at run-time.

Has anyone come across a solution for these problems while deploying Tomcat
and MySQL in Cloud?

Thanks,
Praveen

Re: Tomcat and MySQL in Azure Cloud

Posted by Pid <pi...@pidster.com>.

On 17 Jul 2010, at 03:12, Praveen Sripati <pr...@gmail.com> wrote:

> Thanks for the reply.
> 
> 1. The primary advantage of the cloud is scalability. We can increase
> servers from 1 to 100 within minutes based on the load. So, initially the
> JDBC URL might have 1 IP and it should be updated to have 100 IPs. So, the
> JDBC URL has to updated dynamically with the number of MySQL instances. Not
> sure if Azure provides a resolvable name, even if it does the JDBC URL has
> to be updated dynamically to reflect all the names of the new MySQL
> instances.

You are missing the point. Stop fixating on the db URL, you will not be able to dynamically update it, you will not be able to dynamically recreate a DBCP datasource.  

Even if you could this would be a really BAD strategy as it would mean each Tomcat would have to pause and wait for all requests to stop processing before each db pool is refreshed. 

The pool refresh operation could take a whole minute, if your clients are on a slow network connection. The Tomcat instance would be unavailable for the whole period.

You would need to write your own DataSource factory to do such a thing, which I wouldn't recommend.

Have you load tested your app, how do you know that your proposed strategy will solve your problem?

Do you not need more Tomcat instances too?


p 



> 
> On Fri, Jul 16, 2010 at 10:19 PM, Pid <pi...@pidster.com> wrote:
> 
>> On 16 Jul 2010, at 15:56, Praveen Sripati <pr...@gmail.com>
>> wrote:
>> 
>>> We are in the process of migrating Tomcat and MySQL to Microsoft Azure
>> Cloud
>>> and facing challenges due to the dynamic nature of the cloud like
>> allocation
>>> of dynamic ip and ports to the instances of Tomcat & MySQL in Azure.
>> Because
>>> of this behavior Tomcat needs to
>>> 
>>> 1) Dynamically update the ip and ports of the different MySQL instances
>> in
>>> the JDBC URL (
>>> 
>> http://dev.mysql.com/doc/refman/5.5/en/connector-j-reference-replication-connection.html
>> ).
>>> Suppose the following is the JDBC URL, then it has to be updated in
>> Tomcat
>>> at run-time when a new instance of MySQL is bought up or an instance of
>>> MySQL is bought down.
>> 
>> So don't put the IP address in there, put a resolvable name instead and
>> dynamically update that - which is a more conventional way of doing things.
>> 
>>> url=jdbc:mysql:replication://127.0.0.1:5104,127.0.0.1:5108,
>> 127.0.0.1:5112,
>>> 127.0.0.1:5116,127.0.0.1:5116/itops
>>> 
>>> 2) We are using DBCP (http://commons.apache.org/dbcp/) for connection
>>> pooling. Similarly when a new instance of MySQL is bought up or an
>> instance
>>> of MySQL is bought down the pool has to be updated dynamically
>> accordingly
>>> at run-time.
>> 
>> While apps are using the pool? Good luck with that.
>> 
>> You'd be better off pooling the DB and having something work out where to
>> route the db pool connections and just point DBCP at that.
>> 
>> 
>> p
>> 
>>> Has anyone come across a solution for these problems while deploying
>> Tomcat
>>> and MySQL in Cloud?
>>> 
>>> Thanks,
>>> Praveen
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 
>> 
> 
> 
> -- 
> Praveen

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


Re: Tomcat and MySQL in Azure Cloud

Posted by Praveen Sripati <pr...@gmail.com>.
Thanks for the reply.

1. The primary advantage of the cloud is scalability. We can increase
servers from 1 to 100 within minutes based on the load. So, initially the
JDBC URL might have 1 IP and it should be updated to have 100 IPs. So, the
JDBC URL has to updated dynamically with the number of MySQL instances. Not
sure if Azure provides a resolvable name, even if it does the JDBC URL has
to be updated dynamically to reflect all the names of the new MySQL
instances.

On Fri, Jul 16, 2010 at 10:19 PM, Pid <pi...@pidster.com> wrote:

> On 16 Jul 2010, at 15:56, Praveen Sripati <pr...@gmail.com>
> wrote:
>
> > We are in the process of migrating Tomcat and MySQL to Microsoft Azure
> Cloud
> > and facing challenges due to the dynamic nature of the cloud like
> allocation
> > of dynamic ip and ports to the instances of Tomcat & MySQL in Azure.
> Because
> > of this behavior Tomcat needs to
> >
> > 1) Dynamically update the ip and ports of the different MySQL instances
> in
> > the JDBC URL (
> >
> http://dev.mysql.com/doc/refman/5.5/en/connector-j-reference-replication-connection.html
> ).
> > Suppose the following is the JDBC URL, then it has to be updated in
> Tomcat
> > at run-time when a new instance of MySQL is bought up or an instance of
> > MySQL is bought down.
>
> So don't put the IP address in there, put a resolvable name instead and
> dynamically update that - which is a more conventional way of doing things.
>
> > url=jdbc:mysql:replication://127.0.0.1:5104,127.0.0.1:5108,
> 127.0.0.1:5112,
> > 127.0.0.1:5116,127.0.0.1:5116/itops
> >
> > 2) We are using DBCP (http://commons.apache.org/dbcp/) for connection
> > pooling. Similarly when a new instance of MySQL is bought up or an
> instance
> > of MySQL is bought down the pool has to be updated dynamically
> accordingly
> > at run-time.
>
> While apps are using the pool? Good luck with that.
>
> You'd be better off pooling the DB and having something work out where to
> route the db pool connections and just point DBCP at that.
>
>
> p
>
> > Has anyone come across a solution for these problems while deploying
> Tomcat
> > and MySQL in Cloud?
> >
> > Thanks,
> > Praveen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Praveen

Re: Tomcat and MySQL in Azure Cloud

Posted by Pid <pi...@pidster.com>.
On 16 Jul 2010, at 15:56, Praveen Sripati <pr...@gmail.com> wrote:

> We are in the process of migrating Tomcat and MySQL to Microsoft Azure Cloud
> and facing challenges due to the dynamic nature of the cloud like allocation
> of dynamic ip and ports to the instances of Tomcat & MySQL in Azure. Because
> of this behavior Tomcat needs to
> 
> 1) Dynamically update the ip and ports of the different MySQL instances in
> the JDBC URL (
> http://dev.mysql.com/doc/refman/5.5/en/connector-j-reference-replication-connection.html).
> Suppose the following is the JDBC URL, then it has to be updated in Tomcat
> at run-time when a new instance of MySQL is bought up or an instance of
> MySQL is bought down.

So don't put the IP address in there, put a resolvable name instead and dynamically update that - which is a more conventional way of doing things.

> url=jdbc:mysql:replication://127.0.0.1:5104,127.0.0.1:5108,127.0.0.1:5112,
> 127.0.0.1:5116,127.0.0.1:5116/itops
> 
> 2) We are using DBCP (http://commons.apache.org/dbcp/) for connection
> pooling. Similarly when a new instance of MySQL is bought up or an instance
> of MySQL is bought down the pool has to be updated dynamically accordingly
> at run-time.

While apps are using the pool? Good luck with that.

You'd be better off pooling the DB and having something work out where to route the db pool connections and just point DBCP at that.


p

> Has anyone come across a solution for these problems while deploying Tomcat
> and MySQL in Cloud?
> 
> Thanks,
> Praveen

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


Re: Tomcat and MySQL in Azure Cloud

Posted by André Warnier <aw...@ice-sa.com>.
Praveen Sripati wrote:
> We are in the process of migrating Tomcat and MySQL to Microsoft Azure Cloud
> and facing challenges due to the dynamic nature of the cloud like allocation
> of dynamic ip and ports to the instances of Tomcat & MySQL in Azure. Because
> of this behavior Tomcat needs to
> 
> 1) Dynamically update the ip and ports of the different MySQL instances in
> the JDBC URL (
> http://dev.mysql.com/doc/refman/5.5/en/connector-j-reference-replication-connection.html).
> Suppose the following is the JDBC URL, then it has to be updated in Tomcat
> at run-time when a new instance of MySQL is bought up or an instance of
> MySQL is bought down.
> 
> url=jdbc:mysql:replication://127.0.0.1:5104,127.0.0.1:5108,127.0.0.1:5112,
> 127.0.0.1:5116,127.0.0.1:5116/itops
> 
> 2) We are using DBCP (http://commons.apache.org/dbcp/) for connection
> pooling. Similarly when a new instance of MySQL is bought up or an instance
> of MySQL is bought down the pool has to be updated dynamically accordingly
> at run-time.
> 
> Has anyone come across a solution for these problems while deploying Tomcat
> and MySQL in Cloud?
> 
I don't know anything about the MS Azure Cloud, but the example you are giving above does 
not seem to make sense in the context which you are describing.
127.0.0.1 is always "localhost", so even if there is some dynamics involved, that should 
not change, or ?



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