|
nobody has this problem? Slow down using RMI in Webstart? -
09-23-2008, 02:17 PM
Hi
i searched and searched over the internet but nobody seems to have this problem that we have. I guess nobody uses RMI in a Webstart application?
First we had something like this remote method:
public MyReturnData performQuery(String, Integer)
This was just fast. but we changed our way of doing and now we do this:
public MyReturnData performQuery(OurCustomObject)
And now suddenly RMI calls are way slower especially if the client and server are pretty far from each other (europa and usa)
We searched and searched and suddenly noticed that for doing that simple call a lot of data that didnt even fit in 1 tcp package (1500 bytes). but it took between 4000 and 6000+ bytes.. So instead of 1 tcp package it where 3 or 4 packages. If we looked at the content we suddenly see for those things an enormous classpath in the data for pretty much every call!
This is because of
RMIClassLoader
public static String getClassAnnotation(Class<?> cl)
for a class that is loaded from the jnlpclassloader that will return a long string of all the urls that are in the classloader! But why we dont want that because our server has already those classes because the jnlp classloader got it from there!
The only thing that could help was setting the:
System.getProperty("java.rmi.server.RMIClassLoader Spi");
But that property which is a classname is loaded like this:
Class providerClass =
Class.forName(providerClassName, false,
ClassLoader.getSystemClassLoader());
with the system classloader! but my class that i set is ofcourse loaded by the jnlp loader so i get a ClassDefNotFound error... So this option is out.
I looked at looked and as far as i can see there is only 1 solution.. rewrite all our remote methods to something like this:
public MyReturnData performQuery(byte[])
and do our our object->byte[] first and back again on the other side..
This is really stupid...
But as i started, does really nobody see this? Or does everybody just accepts and thinks rmi is that slow when using with webstart?
|