You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by 印华 <hy...@cheercode.com> on 2008/01/17 05:59:51 UTC

how to communicate between different tomcat servers

hi, all
I build a web application based on tomcat. In my design, I devide the server side into several separate logic parts,and each part is deployed on a separate Tomcat server. e.g. the first tomcat server is to process login request, second tomcat server is to calculate user data, the third tomcat server is to store all the user information. It is a distribute architecure, and I hope in this way, this system can be extended by adding tomcat server when the application load on one Tomcat server is big enough.  For example, when the second tomcat server's calculation work is too big, I can add a new Tomcat server to do calculation work, so do the first Tomcat server for processing login, while in the system, there is only one Tomcat server to store the total user information. This architecture is widely used in the Client/Server mode application, while I'm not sure whether in Browser/Server mode it can work. 
I think this requirment is different to the Tomcat cluster, because Tomcat cluster can solve the load balance problem, while in my case, I would like to keep some global data on one Tomcat server such as the third tomcat server. So currently, I meet a problem of how to communicate between the tomcat servers, I think http or webservice can do this work simply, but the efficiency is not good, and I don't know whether JMS is a good choice for this. I wonder if there is any other way to communicate between the tomcat server? Can tomcat servers work in such a distribute way?

Any help and suggestion will be welcome.

Thank you very much

Frank

Re: [!! SPAM] Re: how to communicate between different tomcat servers

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David,

David Brown wrote:
| Hello, are talking about between TC instances or one or more
| applications (dot).war deployed under one or more TC instances?

The OP indicated that separate Tomcat instances were involved.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkeWjE8ACgkQ9CaO5/Lv0PAPMwCgq/T8jROI9nHVXHZYasIR4x1+
wbsAn2ps6RZyQWM6W/RXGfHctAgF/Bmo
=4lux
-----END PGP SIGNATURE-----

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


Re: [!! SPAM] Re: how to communicate between different tomcat servers

Posted by David Brown <da...@davidwbrown.name>.
Hello, are talking about between TC instances or one or more applications (dot).war deployed under one or more TC instances?

Christopher Schultz wrote ..
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Frank,
> 
> frank wrote:
> | I try to arrange all the services on one webserver, anyway if it need
> | to be devided into several servers, I have to find a way to communicate
> | between the servers, and I may use JMS or RMI to implement this. How
> | about the diffierence between JMS and RMI?
> 
> RMI is used for passing objects (and issuing remote method calls), while
> JMS is used more for passing "messages". JMS can be used to bridge
> between Java and other languages, since IIRC the messages can be
> transformed to some other format (like MQ, etc.). With RMI, you're stuck
> with Java.
> 
> RMI has always seemed to be a PITA to me. I don't think either of these
> technologies are the way you really want to go.
> 
> I think the best thing for you to do is either store the information in
> a shared database (or not) and then trade keys (or whole data sets)
> through SOAP or REST-based services.
> 
> - -chris
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.8 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAkeWEEUACgkQ9CaO5/Lv0PBOWwCeM3SI4hwm4sN2x318YnT/6xD+
> xjMAmwcyH2S98z592er4TsBsadMedcRg
> =PFle
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org

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


Re: [!! SPAM] Re: how to communicate between different tomcat servers

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Frank,

frank wrote:
| I try to arrange all the services on one webserver, anyway if it need
| to be devided into several servers, I have to find a way to communicate
| between the servers, and I may use JMS or RMI to implement this. How
| about the diffierence between JMS and RMI?

RMI is used for passing objects (and issuing remote method calls), while
JMS is used more for passing "messages". JMS can be used to bridge
between Java and other languages, since IIRC the messages can be
transformed to some other format (like MQ, etc.). With RMI, you're stuck
with Java.

RMI has always seemed to be a PITA to me. I don't think either of these
technologies are the way you really want to go.

I think the best thing for you to do is either store the information in
a shared database (or not) and then trade keys (or whole data sets)
through SOAP or REST-based services.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkeWEEUACgkQ9CaO5/Lv0PBOWwCeM3SI4hwm4sN2x318YnT/6xD+
xjMAmwcyH2S98z592er4TsBsadMedcRg
=PFle
-----END PGP SIGNATURE-----

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


Re: [!! SPAM] Re: how to communicate between different tomcat servers

Posted by frank <hy...@cheercode.com>.
Thank you chris for your reply.
I try to arrange all the services on one webserver, anyway if it need to be devided into several servers, I have to find a way to communicate between the servers, and I may use JMS or RMI to implement this. How about the diffierence between JMS and RMI?

Thanks a lot




frank
2008-01-22



发件人: Christopher Schultz
发送时间: 2008-01-18 01:51:45
收件人: Tomcat Users List
抄送: 
主题: [!! SPAM] Re: how to communicate between different tomcat servers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Frank,

印华 wrote:
| In my design, I
| [have divided] the server side into several separate logic parts, and each
| part is deployed on a separate Tomcat server. e.g. the first tomcat
| server is to process login request, second tomcat server is to
| calculate user data, the third tomcat server is to store all the user
| information. It is a [distributed] architecture, and I hope in this way,
| this system can be extended by adding tomcat server when the
| application load on one Tomcat server is big enough.

I'm not sure you need all that complexity... most people just run the
whole application on a single server. When the load gets too high for
one server, you duplicate the web app onto a second server (and so on)
and then load balance between them. There's no reason to have physically
separated login, calculation, and data storage mechanisms.

| So currently, I meet a problem of how to
| communicate between the tomcat servers, I think http or webservice
| can do this work simply, but the efficiency is not good, and I don't
| know whether JMS is a good choice for this.

JSM isn't really any better or worse than SOAP, REST, or other
"standard" forms of communication.

| I wonder if there is any
| other way to communicate between the tomcat server?

Servers can communicate in lots of ways:
1. Records through a database
2. Binary or text data through a socket
3. Binary or text data through a named pipe (on a shared filesystem)
4. Objects through JNDI
5. Objects through RMI

| Any help and suggestion will be welcome.

Honestly, the best thing to do would be to put everything into a single
web app and just load balance between (identical) Tomcat servers. I
don't see any advantage of the separation you have created.

If you need sessions to be replicated in a cluster, you can simply turn
on "distributable" sessions and configure the Tomcat instances to
participate in the cluster. If you can tolerate the loss of information
resulting from a Tomcat instance going down while a user is logged-in,
then you don't even have to do that.

Less complexity results in easier maintenance. Hardware is cheap.
Manpower is expensive.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkePj6kACgkQ9CaO5/Lv0PCp8QCgirMzuuO3iuUgh0Ql3tZZ7qUZ
tEYAmgMFDz227mn6yf/wYQsITodDJIVU
=93Cr
-----END PGP SIGNATURE-----

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

Re: [!! SPAM] Re: how to communicate between different tomcat servers

Posted by frank <hy...@cheercode.com>.
Thank you chris for your reply.
I try to arrange all the services on one webserver, anyway if it need to be devided into several servers, I have to find a way to communicate between the servers, and I may use JMS or RMI to implement this. How about the diffierence between JMS and RMI?

Thanks a lot




frank
2008-01-22



发件人: Christopher Schultz
发送时间: 2008-01-18 01:51:45
收件人: Tomcat Users List
抄送: 
主题: [!! SPAM] Re: how to communicate between different tomcat servers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Frank,

印华 wrote:
| In my design, I
| [have divided] the server side into several separate logic parts, and each
| part is deployed on a separate Tomcat server. e.g. the first tomcat
| server is to process login request, second tomcat server is to
| calculate user data, the third tomcat server is to store all the user
| information. It is a [distributed] architecture, and I hope in this way,
| this system can be extended by adding tomcat server when the
| application load on one Tomcat server is big enough.

I'm not sure you need all that complexity... most people just run the
whole application on a single server. When the load gets too high for
one server, you duplicate the web app onto a second server (and so on)
and then load balance between them. There's no reason to have physically
separated login, calculation, and data storage mechanisms.

| So currently, I meet a problem of how to
| communicate between the tomcat servers, I think http or webservice
| can do this work simply, but the efficiency is not good, and I don't
| know whether JMS is a good choice for this.

JSM isn't really any better or worse than SOAP, REST, or other
"standard" forms of communication.

| I wonder if there is any
| other way to communicate between the tomcat server?

Servers can communicate in lots of ways:
1. Records through a database
2. Binary or text data through a socket
3. Binary or text data through a named pipe (on a shared filesystem)
4. Objects through JNDI
5. Objects through RMI

| Any help and suggestion will be welcome.

Honestly, the best thing to do would be to put everything into a single
web app and just load balance between (identical) Tomcat servers. I
don't see any advantage of the separation you have created.

If you need sessions to be replicated in a cluster, you can simply turn
on "distributable" sessions and configure the Tomcat instances to
participate in the cluster. If you can tolerate the loss of information
resulting from a Tomcat instance going down while a user is logged-in,
then you don't even have to do that.

Less complexity results in easier maintenance. Hardware is cheap.
Manpower is expensive.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkePj6kACgkQ9CaO5/Lv0PCp8QCgirMzuuO3iuUgh0Ql3tZZ7qUZ
tEYAmgMFDz227mn6yf/wYQsITodDJIVU
=93Cr
-----END PGP SIGNATURE-----

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

Re: how to communicate between different tomcat servers

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Frank,

印华 wrote:
| In my design, I
| [have divided] the server side into several separate logic parts, and each
| part is deployed on a separate Tomcat server. e.g. the first tomcat
| server is to process login request, second tomcat server is to
| calculate user data, the third tomcat server is to store all the user
| information. It is a [distributed] architecture, and I hope in this way,
| this system can be extended by adding tomcat server when the
| application load on one Tomcat server is big enough.

I'm not sure you need all that complexity... most people just run the
whole application on a single server. When the load gets too high for
one server, you duplicate the web app onto a second server (and so on)
and then load balance between them. There's no reason to have physically
separated login, calculation, and data storage mechanisms.

| So currently, I meet a problem of how to
| communicate between the tomcat servers, I think http or webservice
| can do this work simply, but the efficiency is not good, and I don't
| know whether JMS is a good choice for this.

JSM isn't really any better or worse than SOAP, REST, or other
"standard" forms of communication.

| I wonder if there is any
| other way to communicate between the tomcat server?

Servers can communicate in lots of ways:
1. Records through a database
2. Binary or text data through a socket
3. Binary or text data through a named pipe (on a shared filesystem)
4. Objects through JNDI
5. Objects through RMI

| Any help and suggestion will be welcome.

Honestly, the best thing to do would be to put everything into a single
web app and just load balance between (identical) Tomcat servers. I
don't see any advantage of the separation you have created.

If you need sessions to be replicated in a cluster, you can simply turn
on "distributable" sessions and configure the Tomcat instances to
participate in the cluster. If you can tolerate the loss of information
resulting from a Tomcat instance going down while a user is logged-in,
then you don't even have to do that.

Less complexity results in easier maintenance. Hardware is cheap.
Manpower is expensive.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkePj6kACgkQ9CaO5/Lv0PCp8QCgirMzuuO3iuUgh0Ql3tZZ7qUZ
tEYAmgMFDz227mn6yf/wYQsITodDJIVU
=93Cr
-----END PGP SIGNATURE-----

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


RE: how to communicate between different tomcat servers

Posted by me...@pjm.com.
1) You may want to consider JBOSS or GLASSFISH (Which ever one supports
clustering better). This is the best done utilizing full blown J2EE
servers.  This is why JEE was created in a first place. 

Tomcat should be used by your front end tier. 

Good luck.



-----Original Message-----
From: hyin@cheercode.com [mailto:hyin@cheercode.com] 
Sent: Thursday, January 17, 2008 12:00 AM
To: users
Subject: how to communicate between different tomcat servers


hi, all
I build a web application based on tomcat. In my design, I devide the
server side into several separate logic parts,and each part is deployed
on a separate Tomcat server. e.g. the first tomcat server is to process
login request, second tomcat server is to calculate user data, the third
tomcat server is to store all the user information. It is a distribute
architecure, and I hope in this way, this system can be extended by
adding tomcat server when the application load on one Tomcat server is
big enough.  For example, when the second tomcat server's calculation
work is too big, I can add a new Tomcat server to do calculation work,
so do the first Tomcat server for processing login, while in the system,
there is only one Tomcat server to store the total user information.
This architecture is widely used in the Client/Server mode application,
while I'm not sure whether in Browser/Server mode it can work. 
I think this requirment is different to the Tomcat cluster, because
Tomcat cluster can solve the load balance problem, while in my case, I
would like to keep some global data on one Tomcat server such as the
third tomcat server. So currently, I meet a problem of how to
communicate between the tomcat servers, I think http or webservice can
do this work simply, but the efficiency is not good, and I don't know
whether JMS is a good choice for this. I wonder if there is any other
way to communicate between the tomcat server? Can tomcat servers work in
such a distribute way?

Any help and suggestion will be welcome.

Thank you very much

Frank

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