Optimizing GraphML I/O

Since GraphML is a human readable XML format, the volume of transferred data can become quite large in a yFiles FLEX application. There are two feasible approaches for reducing the size of the transferred GraphML strings in order to increase application responsiveness:

Transferring Only Structural and Layout Information

If all structural, layout and style information of a graph instance is exported to the GraphML format, the style information constitutes the largest share of the data. Therefore, it is advisable to transfer style information only if the style of graph items might actually change. Often, only the layout of a yFiles FLEX application changes or a default style can be applied to new graph items. In this case, the style information does not need to be transferred.

If a RoundtripHandler is used, the exported data can be configured by using the sendOptions() property.

On GraphMLIOHandler, the export of style data can be prevented by setting writeStyles() to false.

Enabling Client-Side Compression

Since version 1.1 of yFiles FLEX, the RoundtripHandler offers a compression() property that determines whether the GraphML data that is uploaded from the client to the server will be compressed. If the property is set to true (the default), the GraphML data will be compressed using zlib compression and encoded using base64 encoding.

If compression is activated, the "graphEncoding" parameter is prepended with "base64/deflate". Hence, the server can determine whether the data sent by the client has to be decoded and inflated.

Enabling HTTP Compression

The size of the data transferred from a server to a yFiles FLEX client can be vastly reduced by enabling HTTP compression. The configuration for transferring a zipped stream to the client depends on the server technology used.

For a Tomcat server, GZip compression can be activated for each Connector and various MIME types by adapting the server.xml configuration file:

Example 4.11. Enabling GZip compression for a Tomcat server

<Connector
  port="8080" ..
  compression="on" 
  compressionMinSize="2048" 
  compressableMimeType="text/html,text/xml,text/plain" />
  ..
</Connector>

If HTTP compression is activated on the server, nothing needs to be done on the client, since the mx.rpc.http.HTTPService supports the gzip and deflate content types out-of-the-box.