Saturday, October 30, 2010

RPC serialisation problem

Hello,

I need some hints to improve the speed of serialisation.

On server side a make a call to a database to get data from it. This
is quiet fast, needs about 2 seconds to get 68000 entries.
When sending the data to the client to display it in a table, I
seperated the entries to transfer it in pieces of 100 elements to the
client.

My object to serialize looks like this:

public class ObjectNameDto implements IsSerializable {

/**
*
*/
private static final long serialVersionUID = 5445630429242485561L;
private int id;
private String name;

public ObjectNameDto() {
}

public ObjectNameDto(int id) {
this.id = id;
}

/**
* @return the id
*/
public int getObjectNameId() {
return id;
}

/**
* @param id
* the id to set
*/
public void setObjectNameId(int id) {
this.id = id;
}

/**
* @return the name
*/
public String getName() {
return name;
}

/**
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}

/**
* Element count.
*
* @return the int
*/
public static int elementCount() {
return 2;
}
}

My custom field serialiser is this one:

public class ObjectNameDto_CustomFieldSerializer {

public static ObjectNameDto initiate(SerializationStreamReader
reader) throws SerializationException {

return new ObjectNameDto();

}

public static void serialize(SerializationStreamWriter writer,
ObjectNameDto instance)
throws SerializationException {
if (instance == null) {
throw new NullPointerException("ObjectNameDto object is null");
} else {
writer.writeInt(instance.getObjectNameId());
writer.writeString(instance.getName());
}
}

public static void deserialize(SerializationStreamReader reader,
ObjectNameDto instance)
throws SerializationException {
instance.setObjectNameId(reader.readInt());
instance.setName(reader.readString());
}
}

The serialisation for 100 elements takes 4 seconds and thats too much
time.

How can I improve the speed of serialisation from client to server?

Thanks for any hints.

Stephan

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment