Erel Segal-Halevi
Erel Segal-Halevi

Reputation: 36813

GWT - split client and server to different machines

Our lab has a single machine that is open to http connections from outside. However, this machine is quite weak (little memory, slow CPU). We have other machines that are much stronger, but they are behind a firewall and cannot be accessed from outside the lab.

I am writing a GWT app whose server is very demanding. Is it possible to install the server on a strong computer, and the client on the weak compuer, and have them connect using RPC? I assume it requires some changes in the web.xml file, but what exactly?

Theoretically I can just wrap the demanding part in a separate TCP/IP server, and have the GWT server contact it, but I would like to know if it is possible to do directly in GWT.

Upvotes: 0

Views: 1155

Answers (3)

David Levesque
David Levesque

Reputation: 22451

The GWT client is downloaded from the server and runs inside a Web browser as javascript code. I don't quite understand what part of the GWT app you would want to run on a separate server.

If your GWT servlet (the RPC service implementation) is accessing external resources, like a database or Web services, you could move those resources to a separate server.

Another option is to install a reverse proxy on the "weak" server that would forward specific requests to a stronger server behind the firewall. The proxying could be done by Apache (httpd) on the "weak" server (using mod_proxy). Then Tomcat would only need to be installed on the stronger machine, and would take care of most of the processing.

Upvotes: 1

Sreehari Puliyakkot
Sreehari Puliyakkot

Reputation: 736

Depends on your setup.

GWT ACRIS- Please see this link.

EJB - One approach could be to keep business objects in remote machines as EJBs and your servlets accessing them over RMI/JNDI.

Spring - Another simple way to do it is with Spring Remoting. See this link.

Upvotes: 1

george_h
george_h

Reputation: 1592

I have tried to do this but was only successful in splitting a GWT project into 3 parts (Client, RPC, Server) as eclipse projects. In the end you are going to end up with 1 big WAR file and it'll be deployed in one place (unless someone else was successful at really separating the code.)

A solution you can do is to set up another server that will do all the server side processing (your strong machine) and have the GWT servlets act like a proxy. They accept the requests from the client and forward the data to another server for processing. Then wait for the response.

How you do it is up to you. You could use web-services, direct socket connection, JMS ..etc.

Upvotes: 1

Related Questions