Parallel Serialization [message #1833941] |
Wed, 28 October 2020 14:40 |
L R Messages: 12 Registered: July 2019 |
Junior Member |
|
|
Our project is translating from one Xtext grammar to another. As part of this translation, we perform a many to many translation as one single operation. We have found that the serialization takes a long time to process. To improve this, we were considering performing serialization in parallel. Unfortunately, we have been seeing various exceptions in the serialization that we attribute to parallel operation.
We found the recent blog post: https://blogs.itemis.com/en/how-the-code-generation-process-in-xtext-can-be-executed-parallely. This post was regarding code generation execution in parallel. This included mentioning that EMF is not thread-safe and to take special care regarding proxy resolution.
We also found a couple of old open issues related to this topic:
https://github.com/eclipse/xtext-core/issues/203
https://github.com/eclipse/xtext-core/issues/906
The recommendation at the end of 203 was to run a static initialization in a single thread before running the actual serialization. While the recommendation at the end of 906 was to create a custom GrammarProvider and install the adapters upfront.
In our scenario, we generated the ASTs serially and the resulting grammar does not have proxy elements. Each AST has its own Resource, but they all share the same injected ResourceSet. However, even after running an initial serialization serially, we occasionally still receive a serialization exception. Is there guidance on how much serialization needs to be performed by the static initialization?
I have prototyped a custom GrammarProvider, similar to the 906 solution, but haven't tried it enough to see if it resolves this issue.
Overall, is there guidance on how to safely perform serialization in parallel?
|
|
|
|
Re: Parallel Serialization [message #1833943 is a reply to message #1833941] |
Wed, 28 October 2020 14:55 |
|
Since the target is again a target DSL code, why not simply generate the target with model2text, i.e. code generation?
I doubt that parallelization of the serialization is doable with reasonable effort. Sorry, we can't offer guide on that approach, we did not do it that way before.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03123 seconds