· 8 years ago · Jul 31, 2018, 03:34 AM
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 *
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 *
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(user_name, playlist_name, song_id);
79
80 - CREATE MATERIALIZED VIEW IF NOT EXISTS mview.genre_to_user AS
81 SELECT *
82 FROM user_playlists
83 WHERE song_id IS NOT NULL
84 AND playlist_name IS NOT NULL
85 AND user_name IS NOT NULL
86 AND genre IS NOT NULL
87 PRIMARY KEY(user_name, playlist_name, song_id);
88
89 - CREATE MATERIALIZED VIEW IF NOT EXISTS mview.recently_played AS
90 SELECT *
91 FROM user_playlists
92 WHERE song_id IS NOT NULL
93 AND playlist_name IS NOT NULL
94 AND user_name IS NOT NULL
95 AND last_played IS NOT NULL
96 PRIMARY KEY(user_name, playlist_name, song_id);
97
98 - CREATE MATERIALIZED VIEW IF NOT EXISTS mview.song_by_playlist AS
99 SELECT *
100 FROM user_playlists
101 WHERE song_id IS NOT NULL
102 AND playlist_name IS NOT NULL
103 AND user_name IS NOT NULL
104 AND last_played IS NOT NULL
105 PRIMARY KEY (playlist_name, song_id, user_name);
106
107 - CREATE MATERIALIZED VIEW IF NOT EXISTS mview.user_to_song AS
108 SELECT *
109 FROM user_playlists
110 WHERE song_id IS NOT NULL
111 AND playlist_name IS NOT NULL
112 AND user_name IS NOT NULL
113 AND last_played IS NOT NULL
114 PRIMARY KEY (user_name, song_id, playlist_name);
115
116#
117# Optional meta information on the generated columns in the above table
118# The min and max only apply to text and blob types
119# The distribution field represents the total unique population
120# distribution of that column across rows. Supported types are
121#
122# EXP(min..max) An exponential distribution over the range [min..max]
123# EXTREME(min..max,shape) An extreme value (Weibull) distribution over the range [min..max]
124# GAUSSIAN(min..max,stdvrng) A gaussian/normal distribution, where mean=(min+max)/2, and stdev is (mean-min)/stdvrng
125# GAUSSIAN(min..max,mean,stdev) A gaussian/normal distribution, with explicitly defined mean and stdev
126# UNIFORM(min..max) A uniform distribution over the range [min, max]
127# FIXED(val) A fixed distribution, always returning the same value
128# SEQ(min..max) A fixed sequence, returning values in the range min to max sequentially (starting based on seed), wrapping if necessary.
129# Aliases: extr, gauss, normal, norm, weibull
130#
131# If preceded by ~, the distribution is inverted
132#
133# Defaults for all columns are size: uniform(4..8), population: uniform(1..100B), cluster: fixed(1)
134#
135columnspec:
136 - name: user_name
137 size: uniform(1..100)
138 population: uniform(1..1B) # the range of unique values to select for the field (default is 100Billion)
139 - name: song_id
140 population: gaussian(1..100000)
141 cluster: uniform(1..2)
142
143
144# The insert operation
145insert:
146 partitions: uniform(1..1) # Number of unique partitions to update in a single insert op.
147 # Defaults to fixed(1)
148 partitions-per-batch: SINGLE # SINGLE or MULTIPLE partitions per-batch; multiple partitions in a
149 # single batch is a pessimization, but it's allowed. Defaults to SINGLE.
150 max-rows-per-batch: uniform(1..1)
151 # Maximum size of a batch. Rows are inserted in batches of up to
152 # max-rows-per-batch, and after each batch is sent max-rows-per-batch
153 # is regenerated from this distribution. If the generated value is 0,
154 # then each partition (for SINGLE partitions-per-batch) or all partitions
155 # (for MULTIPLE partitions-per-batch) is inserted in a single batch (so if you
156 # always require this behaviour, use fixed(0)). Defaults to fixed(100).
157 batchtype: UNLOGGED # Type of batch to use: LOGGED, UNLOGGED or COUNTER
158 select: uniform(1..10)/10 # Proportion of rows that will be generated in each partition. The number of rows
159 # per-partition will be determined by <select-value> * <partition-size>, where
160 # <partition-size> is the number of possible rows in a partition, as determined by
161 # the columns with cluster keys in the columnspec above. This will be
162 # generated for each partition in a single insert op.
163 # Defaults to fixed(1)/1
164 row-population: fixed(1)/1 # Proportion of populated columns in a row.
165 # Defaults to fixed(1)/1
166#
167#
168# A list of queries you wish to run against the schema
169#
170queries:
171 read_standard:
172 cql: select * from mview.artist_to_user where artist_name = ? and user_name = ? LIMIT 100
173 fields: samerow # samerow or multirow (select arguments from the same row, or randomly from all rows in the partition)
174# range1:
175# cql: select * from typestest where name = ? and choice = ? and date >= ? LIMIT 100
176# fields: multirow # samerow or multirow (select arguments from the same row, or randomly from all rows in the partition)
177#
178# A list of bulk read queries that analytics tools may perform against the schema
179# Each query will sweep an entire token range, page by page.
180#
181# token_range_queries:
182# all_columns_tr_query:
183# columns: '*'
184# page_size: 5000
185
186# value_tr_query:
187# columns: value