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

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

                Author: ASF GitHub Bot
            Created on: 12/Feb/19 01:56
            Start Date: 12/Feb/19 01:56
    Worklog Time Spent: 10m 
      Work Description: ihji commented on pull request #7547: [BEAM-6443] 
decrease the number of thread for BigQuery streaming inse…
URL: https://github.com/apache/beam/pull/7547#discussion_r255773210
 
 

 ##########
 File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryServicesImpl.java
 ##########
 @@ -945,4 +951,132 @@ public static CustomHttpErrors 
createBigQueryClientCustomErrors() {
             + 
"https://cloud.google.com/service-infrastructure/docs/rate-limiting#configure";);
     return builder.build();
   }
+
+  private static class BoundedExecutorService implements ExecutorService {
+    private ExecutorService executor;
+    private Semaphore semaphore;
+
+    BoundedExecutorService(ExecutorService executor, int parallelism) {
+      this.executor = executor;
+      this.semaphore = new Semaphore(parallelism);
+    }
+
+    @Override
+    public void shutdown() {
+      executor.shutdown();
+    }
+
+    @Override
+    public List<Runnable> shutdownNow() {
 
 Review comment:
   Yes, you're right. Ideally we should return runnable objects which have the 
same behavior as we put in. However it seems impossible because the delegated 
`shutdownNow()` doesn't only return `SemaphoreRunnable` but also 
`RunnableFuture` that there's no way to access to its original 
`SemaphoreCallable` object. I think we can allow the semaphore object to have 
the maximum number of permits before returning from `shutdownNow()` as 
less-ideal alternative. 
 
----------------------------------------------------------------
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: 197310)
    Time Spent: 2h 50m  (was: 2h 40m)

> decrease the number of threads for BigQuery streaming insertAll
> ---------------------------------------------------------------
>
>                 Key: BEAM-6443
>                 URL: https://issues.apache.org/jira/browse/BEAM-6443
>             Project: Beam
>          Issue Type: Improvement
>          Components: io-java-gcp
>            Reporter: Heejong Lee
>            Assignee: Heejong Lee
>            Priority: Major
>              Labels: triaged
>          Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> When inserting (a large number of ) very small elements into BigQuery via 
> streaming insertAll, BigQueryIO causes lots of quota exceeded errors. This 
> implies that 1) BigQueryIO puts unnecessary overheads on BigQuery API layer 
> by sending requests too fast 2) log file becomes very big because of repeated 
> same error messages. Currently we use 50 shards for writing data into 
> BigQuery and in each bundle 20-30 futures are executed simultaneously with 
> unlimited thread pool. It would be worth investigating whether just single 
> thread pool is sufficient for running concurrent insertAll.



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

Reply via email to