4

I am using XStream as part of my application for serializing objects. For one of the use cases, I have to serialize some of the objects implementing Externalizable interface. For my use case I would like to serialize them using native Java serialization.

I found a link on the internet, http://old.nabble.com/How-to-remove-Externalizable-Converter-td22747484.html, which helped me address this issue and started using Reflection Converter for Externalizable objects.

When testing the application, I am seeing that the application is spending lot of time (10's of seconds) in converter code during highly concurrent access. I can see that the problem is in the buildMap method of FieldDictionary.

I was wondering if there is a better way to address my original issue? Is the performance for Reflection Converter expected to be bad when having highly concurrent environment?

To give some additional context on the environment. It is a web application and the serialization is happening during the request processing and application can have 100's of concurrent threads.

I really appreciate any help/advice regarding this.

SKP
  • 135
  • 4
  • 1
    XStream team fixed the code. Fix involved moving some code to get the cached element out of sync block. [JIRA case](https://jira.codehaus.org/browse/XSTR-705) – SKP Sep 24 '12 at 22:27

1 Answers1

0

This is technically not an answer.. but I hope it helps anyways.

While creating a Java Swing based desktop app that was used for Bio-molecular research modeling, we were serializing very complicated and interconnected object graphs to disk for performance reasons.

Even after working our way through Externalization and Serializable related issues, we had to abandon the whole approach and start fresh, because Java serialization is very sensitive to object structure / name etc. Which means innocent refactoring of the model was leading to major crashes in production, when users tried to load old serialized models.

Eventually we created a data store friendly object structure (No strong inter-references to other nodes in the graph), and serialized this structure. This was much simpler, less error prone and much faster than serializing and deserializing the original graph. This also meant that we could refactor / modify our domain graph objects at will, as long as the Adapters (components that converted Domain objects to DataStore objects) was kept updated properly.

Akshay
  • 3,158
  • 24
  • 28