[ 
https://issues.apache.org/jira/browse/BEAM-4049?focusedWorklogId=90851&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-90851
 ]

ASF GitHub Bot logged work on BEAM-4049:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Apr/18 15:45
            Start Date: 13/Apr/18 15:45
    Worklog Time Spent: 10m 
      Work Description: aromanenko-dev commented on a change in pull request 
#5112: [BEAM-4049] Improve CassandraIO write throughput by performing async 
queries
URL: https://github.com/apache/beam/pull/5112#discussion_r181428572
 
 

 ##########
 File path: 
sdks/java/io/cassandra/src/main/java/org/apache/beam/sdk/io/cassandra/CassandraServiceImpl.java
 ##########
 @@ -373,11 +378,22 @@ public WriterImpl(CassandraIO.Write<T> spec) {
     @Override
     public void write(T entity) {
       Mapper<T> mapper = (Mapper<T>) mappingManager.mapper(entity.getClass());
-      mapper.save(entity);
+      this.writeFutures.add(mapper.saveAsync(entity));
+      if (this.writeFutures.size() % CONCURRENT_ASYNC_QUERIES == 0) {
+        // We reached the max number of allowed in flight queries
+        LOG.debug("Waiting for a batch of 100 Cassandra writes to be 
executed...");
+        Futures.successfulAsList(this.writeFutures);
 
 Review comment:
   Does it make sense to check that there were some failures (if any) and, 
perhaps optionally, stop a pipeline with providing some errors/exceptions in 
logs for user? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 90851)
    Time Spent: 0.5h  (was: 20m)

> Improve write throughput of CassandraIO
> ---------------------------------------
>
>                 Key: BEAM-4049
>                 URL: https://issues.apache.org/jira/browse/BEAM-4049
>             Project: Beam
>          Issue Type: Improvement
>          Components: io-java-cassandra
>    Affects Versions: 2.4.0
>            Reporter: Alexander Dejanovski
>            Assignee: Jean-Baptiste Onofré
>            Priority: Major
>              Labels: performance
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> The CassandraIO currently uses the mapper to perform writes in a synchronous 
> fashion. 
> This implies that writes are serialized and is a very suboptimal way of 
> writing to Cassandra.
> The IO should use the saveAsync() method instead of save() and should wait 
> for completion each time 100 queries are in flight, in order to avoid 
> overwhelming clusters.



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

Reply via email to