· 8 years ago · Dec 16, 2017, 09:40 PM
1#
2# This is an example YAML profile for cassandra-stress
3#
4# The general form of the command line is as follows:
5#
6# cassandra-stress user profile=<profile.yaml> ops([insert|<read-op>]=<op-ratio>, ...) n=<partition-ops>
7#
8# cassandra-stress will then run multiple parallel consumers (controlled by the
9# -rate threads=<consumers> option):
10#
11# * Each consumer draws an operation at random from the list of ops;
12# * The distribution of the ops is controlled by the <op-ratio> parameter;
13# * Each op will then generate cassandra queries. When limited by the
14# <partition-ops> value:
15# * Each <read-op> will generate a single SELECT query, decrementing
16# <partition-ops> by 1;
17# * Each insert will generate multiple UPDATE queries, decrementing
18# <partition-ops> by the number of unique partitions inserted;
19# * When <partition-ops> is exhausted, cassandra-stress stops.
20
21# insert data
22# cassandra-stress user profile=/home/jake/stress1.yaml ops(insert=1)
23#
24# read, using query simple1:
25# cassandra-stress profile=/home/jake/stress1.yaml ops(simple1=1)
26#
27# mixed workload (90/10)
28# cassandra-stress user profile=/home/jake/stress1.yaml ops(insert=1,simple1=9)
29
30#
31# Keyspace info
32#
33keyspace: mview
34
35#
36# The CQL for creating a keyspace (optional if it already exists)
37#
38keyspace_definition: |
39 CREATE KEYSPACE mview WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};
40
41#
42# Table info
43#
44table: user_playlists
45
46#
47# The CQL for creating a table you wish to stress (optional if it already exists)
48#
49table_definition: |
50 CREATE TABLE IF NOT EXISTS mview.user_playlists
51 (
52 user_name text,
53 playlist_name text,
54 song_id text,
55 added_time bigint,
56 artist_name text,
57 genre text,
58 last_played bigint,
59 PRIMARY KEY (user_name, playlist_name, song_id)
60 );
61
62extra_definitions:
63 - CREATE MATERIALIZED VIEW IF NOT EXISTS mview.song_to_user AS
64 SELECT song_id, user_name, added_time
65 FROM user_playlists
66 WHERE song_id IS NOT NULL
67 AND playlist_name IS NOT NULL
68 AND user_name IS NOT NULL
69 PRIMARY KEY(song_id, user_name, playlist_name);
70
71 - CREATE MATERIALIZED VIEW IF NOT EXISTS mview.artist_to_user AS
72 SELECT song_id, user_name
73 FROM user_playlists
74 WHERE song_id IS NOT NULL
75 AND playlist_name IS NOT NULL
76 AND user_name IS NOT NULL
77 AND artist_name IS NOT NULL
78 PRIMARY KEY(artist_name, user_name, playlist_name, song_id);
79
80
81 - CREATE MATERIALIZED VIEW IF NOT EXISTS mview.genre_to_user AS
82 SELECT song_id, user_name
83 FROM user_playlists
84 WHERE song_id IS NOT NULL
85 AND playlist_name IS NOT NULL
86 AND user_name IS NOT NULL
87 AND genre IS NOT NULL
88 PRIMARY KEY(genre, user_name, playlist_name, song_id);
89
90
91 - CREATE MATERIALIZED VIEW IF NOT EXISTS mview.recently_played AS
92 SELECT song_id, user_name
93 FROM user_playlists
94 WHERE song_id IS NOT NULL
95 AND playlist_name IS NOT NULL
96 AND user_name IS NOT NULL
97 AND last_played IS NOT NULL
98 PRIMARY KEY(user_name, last_played, playlist_name, song_id);
99#
100# Optional meta information on the generated columns in the above table
101# The min and max only apply to text and blob types
102# The distribution field represents the total unique population
103# distribution of that column across rows. Supported types are
104#
105# EXP(min..max) An exponential distribution over the range [min..max]
106# EXTREME(min..max,shape) An extreme value (Weibull) distribution over the range [min..max]
107# GAUSSIAN(min..max,stdvrng) A gaussian/normal distribution, where mean=(min+max)/2, and stdev is (mean-min)/stdvrng
108# GAUSSIAN(min..max,mean,stdev) A gaussian/normal distribution, with explicitly defined mean and stdev
109# UNIFORM(min..max) A uniform distribution over the range [min, max]
110# FIXED(val) A fixed distribution, always returning the same value
111# SEQ(min..max) A fixed sequence, returning values in the range min to max sequentially (starting based on seed), wrapping if necessary.
112# Aliases: extr, gauss, normal, norm, weibull
113#
114# If preceded by ~, the distribution is inverted
115#
116# Defaults for all columns are size: uniform(4..8), population: uniform(1..100B), cluster: fixed(1)
117#
118columnspec:
119 - name: user_name
120 size: uniform(1..100)
121 population: uniform(1..1B) # the range of unique values to select for the field (default is 100Billion)
122 - name: song_id
123 population: gaussian(1..100000)
124 cluster: uniform(1..2)
125
126
127# The insert operation
128insert:
129 partitions: uniform(1..1) # Number of unique partitions to update in a single insert op.
130 # Defaults to fixed(1)
131 partitions-per-batch: SINGLE # SINGLE or MULTIPLE partitions per-batch; multiple partitions in a
132 # single batch is a pessimization, but it's allowed. Defaults to SINGLE.
133 max-rows-per-batch: uniform(1..1)
134 # Maximum size of a batch. Rows are inserted in batches of up to
135 # max-rows-per-batch, and after each batch is sent max-rows-per-batch
136 # is regenerated from this distribution. If the generated value is 0,
137 # then each partition (for SINGLE partitions-per-batch) or all partitions
138 # (for MULTIPLE partitions-per-batch) is inserted in a single batch (so if you
139 # always require this behaviour, use fixed(0)). Defaults to fixed(100).
140 batchtype: UNLOGGED # Type of batch to use: LOGGED, UNLOGGED or COUNTER
141 select: uniform(1..10)/10 # Proportion of rows that will be generated in each partition. The number of rows
142 # per-partition will be determined by <select-value> * <partition-size>, where
143 # <partition-size> is the number of possible rows in a partition, as determined by
144 # the columns with cluster keys in the columnspec above. This will be
145 # generated for each partition in a single insert op.
146 # Defaults to fixed(1)/1
147 row-population: fixed(1)/1 # Proportion of populated columns in a row.
148 # Defaults to fixed(1)/1
149#
150#
151# A list of queries you wish to run against the schema
152#
153queries:
154 simple1:
155 cql: select * from mview.user_playlists LIMIT 100
156 fields: samerow # samerow or multirow (select arguments from the same row, or randomly from all rows in the partition)
157# range1:
158# cql: select * from typestest where name = ? and choice = ? and date >= ? LIMIT 100
159# fields: multirow # samerow or multirow (select arguments from the same row, or randomly from all rows in the partition)
160#
161# A list of bulk read queries that analytics tools may perform against the schema
162# Each query will sweep an entire token range, page by page.
163#
164# token_range_queries:
165# all_columns_tr_query:
166# columns: '*'
167# page_size: 5000
168
169# value_tr_query:
170# columns: value