[ 
https://issues.apache.org/jira/browse/BEAM-5404?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16623768#comment-16623768
 ] 

Niel Markwick commented on BEAM-5404:
-------------------------------------

This bug is incorrect...

It was a bug in my testing which indicated that Java serialization is more 
efficient

My mutations were 10 columns of 10K strings... but the values were _the same_ 
10K string.
ie: String stringValue = new String( /* 10K char array */)

Mutation m = Mutation.newInsertOrUpdateBuilder("table1")
.set("key").to(UUID.randomUUID().toString())
.set("value0").to(stringValue)
.set("value1").to(stringValue)
.set("value2").to(stringValue)
// etc

So when the custom serializer encoded this, it produced a ~100K byte array,
Java serialization was being clever: it only sees one String object to be 
serialized and produced a ~10K byte array...

> Inefficient Serialization of Spanner MutationGroup in pipeline
> --------------------------------------------------------------
>
>                 Key: BEAM-5404
>                 URL: https://issues.apache.org/jira/browse/BEAM-5404
>             Project: Beam
>          Issue Type: Bug
>          Components: io-java-gcp
>    Affects Versions: 2.3.0, 2.4.0, 2.5.0, 2.6.0
>            Reporter: Niel Markwick
>            Assignee: Chamikara Jayalath
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: Not applicable
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> The Cloud Spanner connector uses a custom serialization mechanism to convert 
> MutationGroup objects into a byte array. 
> This mechanism is very inefficient producing byte arrays approx 10x larger 
> than simple Java Serialization of the MutationGroup objects, which increases 
> the resources needed by the connector to ~40x the size of the original 
> mutations.
> There are no obvious benefits to using this custom serialization system, as 
> the objects are deserialized within the pipeline itself. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to