GWT RPC - Multiple RPC Services per Application

I am currently working with a GWT application that has one large RPC service. It has over 100 methods, all of which do different things. What performance benefit / impediment will I get if I split this into several RPC services? I believe that I will need to make a new servlet for each of them.

So, my main questions are: Does GWT create a new RPC servlet for every running client? Will GWT have two servlets for one application if I have two RPC services? If two RPC services cause any performance issues. currently (10-15 concurrent users on one tomcat instance)

+4
source share
2 answers

What performance benefit / impediment would I get if I split it into several RPC services?

I believe that nothing will change in this regard.

I believe that I will need to make a new servlet for each of them.

Not necessary. You can have one RemoteServiceServlet that implements several RemoteService interfaces. You will need to set the same @RemoteServiceRelativePath on all your interfaces so that the client uses the same URL, but you can also map the same servlet to several different URLs (multiple servlet-mapping with the same servlet-name ).

Does GWT create a new RPC servlet for each running client?

GWT does not create a new RPC servlet; if you host your web application on Tomcat, then Tomcat odes creates servlet instances (usually one instance for each class).

+7
source

One of the possible drawbacks of several RPC interfaces: if you have many common model objects between the interfaces, the GWT will generate FieldSerializers for each model object - they will be shared. However, to ensure that each RPC instance references only the serializers that it needs, a TypeSerializer is created for each service proxy. In the case of 10 services, each of which uses 100 model objects, this will lead to 10 TypeSerializer s, each with 100 FieldSerializer registration (three components for each serializer - serialization, instantiation, deserialization).

I have seen at least one application that is almost triple in size under the weight of these common model objects โ€” more than a hundred RPC interfaces and thousands of possible model objects shared between them. Not every model was used in every interface, but it was enough to do such damage. This was mitigated by saving each pair of interfaces separately and creating one giant pair that expanded each of the other interfaces - this way GWT.create used only for this type, and therefore, instead of hundreds, only one giant TypeSerializer .

So keep an eye on your compiled output size and periodically check your SOYC (Story Of Your Compile) report to see what takes up all the space.

+1
source

Source: https://habr.com/ru/post/1435530/


All Articles