github.com/dshekhar95/sub_dgraph@v0.0.0-20230424164411-6be28e40bbf1/dgraph/cmd/bulk/speed_tests/run.sh (about)

     1  #!/bin/bash
     2  
     3  set -euo pipefail
     4  
     5  scriptDir=$(dirname "$(readlink -f "$0")")
     6  
     7  while [[ $# -gt 1 ]]; do
     8  	key="$1"
     9  	case $key in
    10  		--tmp)
    11  			tmp="$2"
    12  			shift
    13  			;;
    14  		*)
    15  			echo "unknown option $1"
    16  			exit 1
    17  			;;
    18  	esac
    19  	shift
    20  done
    21  
    22  tmp=${tmp:-tmp}
    23  
    24  go install -race github.com/dgraph-io/dgraph/cmd/dgraph-bulk-loader
    25  
    26  function run_test {
    27  	[[ $# == 2 ]] || { echo "bad args"; exit 1; }
    28  	schema=$1
    29  	rdfs=$2
    30  
    31  	rm -rf $tmp
    32  	mkdir $tmp
    33  
    34  	echo "$schema" > $tmp/sch.schema
    35  
    36  	# Run bulk loader.
    37  	$(go env GOPATH)/bin/dgraph-bulk-loader -map_shards=5 -reduce_shards=2 -shufflers=2 -mapoutput_mb=15 -tmp "$tmp/tmp" -out "$tmp/out" -l "$tmp/LEASE" -s "$tmp/sch.schema" -r "$rdfs"
    38  }
    39  
    40  echo "========================="
    41  echo " 1 million data set      "
    42  echo "========================="
    43  
    44  run_test '
    45  director.film:        [uid] @reverse @count .
    46  genre:                [uid] @reverse .
    47  initial_release_date: dateTime @index(year) .
    48  name:                 string @index(term) .
    49  starring:             [uid] @count .
    50  ' 1million.rdf.gz
    51  
    52  echo "========================="
    53  echo " 21 million data set     "
    54  echo "========================="
    55  
    56  run_test '
    57  director.film        : [uid] @reverse @count .
    58  actor.film           : [uid] @count .
    59  genre                : [uid] @reverse @count .
    60  initial_release_date : datetime @index(year) .
    61  rating               : [uid] @reverse .
    62  country              : [uid] @reverse .
    63  loc                  : geo @index(geo) .
    64  name                 : string @index(hash, fulltext, trigram) .
    65  starring             : [uid] @count .
    66  _share_hash_         : string @index(exact) .
    67  ' 21million.rdf.gz
    68  
    69  echo "========================="
    70  echo " Graph Overflow          "
    71  echo "========================="
    72  
    73  run_test '
    74  AboutMe: string .
    75  Author: uid @reverse .
    76  Owner: uid @reverse .
    77  DisplayName: string .
    78  Location: string .
    79  Reputation: int .
    80  Score: int .
    81  Text: string @index(fulltext) .
    82  Tag.Text: string @index(hash) .
    83  Type: string @index(exact) .
    84  ViewCount: int @index(int) .
    85  Vote: [uid] @reverse .
    86  Title: [uid] @reverse .
    87  Body: uid @reverse .
    88  Post: uid @reverse .
    89  PostCount: int @index(int) .
    90  Tags: [uid] @reverse .
    91  Timestamp: datetime .
    92  GitHubID: string @index(hash) .
    93  Has.Answer: [uid] @reverse @count .
    94  Chosen.Answer: uid @count .
    95  Comment: [uid] @reverse .
    96  Upvote: [uid] @reverse .
    97  Downvote: [uid] @reverse .
    98  Tag: [uid] @reverse .
    99  ' comments.rdf.gz,posts.rdf.gz,tags.rdf.gz,users.rdf.gz,votes.rdf.gz