github.com/apache/beam/sdks/v2@v2.48.2/python/apache_beam/testing/benchmarks/nexmark/README.md (about)

     1  <!--
     2      Licensed to the Apache Software Foundation (ASF) under one
     3      or more contributor license agreements.  See the NOTICE file
     4      distributed with this work for additional information
     5      regarding copyright ownership.  The ASF licenses this file
     6      to you under the Apache License, Version 2.0 (the
     7      "License"); you may not use this file except in compliance
     8      with the License.  You may obtain a copy of the License at
     9  
    10        http://www.apache.org/licenses/LICENSE-2.0
    11  
    12      Unless required by applicable law or agreed to in writing,
    13      software distributed under the License is distributed on an
    14      "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    15      KIND, either express or implied.  See the License for the
    16      specific language governing permissions and limitations
    17      under the License.
    18  -->
    19  
    20  # How to run a python nexmark benchmark
    21  
    22  ## Batch Mode
    23  
    24  For batch mode, a file needs to be generated first by running java suite and writing events to a file.
    25  
    26  ### Direct Runner
    27  
    28  ```shell script
    29  ./gradlew :sdks:java:testing:nexmark:run \
    30      -Pnexmark.runner=":runners:direct-java" \
    31      -Pnexmark.args="--query=0 --runner=DirectRunner --numEvents=100000 --manageResources=false --monitorJobs=true --enforceEncodability=true --enforceImmutability=true --generateEventFilePathPrefix=/tmp/eventfile"
    32  
    33  ./gradlew :sdks:python:apache_beam:testing:benchmarks:nexmark:run \
    34      -Pnexmark.args="--query=0 --num_events=100000 --runner=DirectRunner --input=/tmp/eventfile\*"
    35  ```
    36  
    37  ### Dataflow Runner
    38  
    39  ```shell script
    40  RUN_DATA=$(uuidgen)
    41  
    42  ./gradlew :sdks:java:testing:nexmark:run \
    43      -Pnexmark.runner=":runners:direct-java" \
    44      -Pnexmark.args="--query=0 --runner=DirectRunner --numEvents=100000 --manageResources=false --monitorJobs=true --enforceEncodability=true --enforceImmutability=true --generateEventFilePathPrefix=gs://temp-storage-for-perf-tests/nexmark/eventfile/$RUN_DATA"
    45  
    46  ./gradlew :sdks:python:apache_beam:testing:benchmarks:nexmark:run \
    47      -Pnexmark.args="--query=0 --num_events=1000000 --runner=DataflowRunner --project=apache-beam-testing --region=us-central1 --temp_location=gs://temp-storage-for-perf-tests/nexmark/PythonQuery0/ --staging_location=gs://temp-storage-for-perf-tests/nexmark/PythonQuery0/ --input=gs://temp-storage-for-perf-tests/nexmark/eventfile/$RUN_DATA\*"
    48  ```
    49  
    50  ## Streaming mode
    51  
    52  First generate and publish events to pubsub using java nexmark suite, exmaple:
    53  ```shell script
    54  ./gradlew :sdks:java:testing:nexmark:run \
    55      -Pnexmark.runner=":runners:google-cloud-dataflow-java"
    56      -Pnexmark.args=" --runner=DataflowRunner --suite=SMOKE --streamTimeout=60 --query=0 --streaming=true --project=apache-beam-testing --region=YOUR_REGION --workerMachineType=n1-highmem-8 --gcpTempLocation=YOUR_TEMP_LOCATION --stagingLocation=YOUR_STAGING_LOCATION --sourceType=PUBSUB --pubSubMode=PUBLISH_ONLY --pubsubTopic=YOUR_TOPIC_NAME --resourceNameMode=VERBATIM --manageResources=false --monitorJobs=false --numEventGenerators=64 --numWorkers=16 --maxNumWorkers=16 --firstEventRate=50000 --nextEventRate=50000 --isRateLimited=true --avgPersonByteSize=500 --avgAuctionByteSize=500 --avgBidByteSize=500 --probDelayedEvent=0.000001 --occasionalDelaySec=60 --numEvents=3000000 --experiments=enable_custom_pubsub_sink --pubsubMessageSerializationMethod=TO_STRING"
    57  ```
    58  
    59  ### Direct Runner
    60  
    61  ```shell script
    62  python nexmark_launcher.py --query 5 --num_events 3000000 --streaming --runner DirectRunner --topic_name YOUR_TOPIC_NAME --subscription_name YOUR_SUB_NAME --project YOUR_PROJECT_NAME --region YOUR_REGION
    63  ```
    64  
    65  ### Dataflow Runner
    66  
    67  ```shell script
    68  python nexmark_launcher.py --query 5 --num_events 3000000 --streaming --runner DataflowRunner --num_workers 16 --machine_type n1-highmem-8 --topic_name YOUR_TOPIC_NAME --subscription_name YOUR_SUB_NAME --project YOUR_PROJECT_NAME --region YOUR_REGION --temp_location YOUR_TEMP_LOCATION --staging_location YOUR_STAGING_LOCATION --sdk_location YOUR_SDK_LOCATION
    69  ```