Yes, bypassing XML altogether will get you the best performance.
This being said, if you are still interested in an XML alternative, I can propose the following:
When the LegStar COBOL binding classes were initially written, back in 2005, JAXB was not part of the JDK and there were several companies claiming to have their own implementations. For that reason, LegStar did not make any assumption regarding JAXBContext thread safety.
I think today it is safe to consider that most everyone uses the JDK's JAXB implementation.
With that in mind, I can change the LegStar binding classes to store the JAXBContext instances in a static hashmap and reuse them. This can be done in legstar-coxbapi and therefore does not necessitate to regenerate or recompile the binding classes.
I ran a quick test and can achieve 220 TPS with this change on the same environment described previously.
Does not address the memory issue you are mentioning though, as there will be as many instances of JAXBContext as you have copybooks (assuming all copybooks are used). I can run more tests to figure out how much memory is allocated per JAXBContext.
Let me know if this can be of interest.
Fady