You can try scoping the string builder instance to processElement, instead
of making it a member of your DoFn. The same DoFn instance can be used for
a bundle of many elements, or possibly even across multiple bundles.

https://beam.apache.org/releases/javadoc/2.23.0/org/apache/beam/sdk/transforms/ParDo.html

On Wed, Sep 2, 2020 at 3:02 PM Talat Uyarer <tuya...@paloaltonetworks.com>
wrote:

> Sorry for the wrong import. You can see on the code I am using
> StringBuilder.
>
> On Wed, Sep 2, 2020 at 2:55 PM Ning Kang <ni...@google.com> wrote:
>
>> Here is a question answered on StackOverflow:
>> https://stackoverflow.com/questions/27221292/when-should-i-use-javas-stringwriter
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__stackoverflow.com_questions_27221292_when-2Dshould-2Di-2Duse-2Djavas-2Dstringwriter&d=DwMFaQ&c=V9IgWpI5PvzTw83UyHGVSoW3Uc1MFWe5J8PTfkrzVSo&r=BkW1L6EF7ergAVYDXCo-3Vwkpy6qjsWAz7_GD7pAR8g&m=mVBqxC5kNOARPduF-c17S1VnIw8gwS6alvgONJKfheY&s=ggveahdPKo3vaAhADvjz4ucjndSmzyOZ8FPBvJ_0oZQ&e=>
>>
>> Could you try using StringBuilder instead since the usage is not
>> appropriate for a StringWriter?
>>
>>
>> On Wed, Sep 2, 2020 at 2:49 PM Talat Uyarer <tuya...@paloaltonetworks.com>
>> wrote:
>>
>>> Hi,
>>>
>>> I have an issue with String Concatenating. You can see my code below.[1]
>>> I have a step on my df job which is concatenating strings. But somehow when
>>> I use that step my job starts getting jvm restart errors.
>>>
>>>  Shutting down JVM after 8 consecutive periods of measured GC thrashing.
>>>> Memory is used/total/max = 4112/5994/5994 MB, GC last/max = 97.36/97.36 %,
>>>> #pushbacks=3, gc thrashing=true. Heap dump not written.
>>>
>>>
>>> And also I try to use Avro rather than String. When I use Avro, it works
>>> fine without any issue. Do you have any suggestions?
>>>
>>> Thanks
>>>
>>> [1] https://dpaste.com/7RTV86WQC
>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__dpaste.com_7RTV86WQC&d=DwMFaQ&c=V9IgWpI5PvzTw83UyHGVSoW3Uc1MFWe5J8PTfkrzVSo&r=BkW1L6EF7ergAVYDXCo-3Vwkpy6qjsWAz7_GD7pAR8g&m=mVBqxC5kNOARPduF-c17S1VnIw8gwS6alvgONJKfheY&s=eSd0NcP8fw5BOZlSXtUMRfYuGWlN-gcXENVwgCmrapY&e=>
>>>
>>>
>>>

Reply via email to