-
Notifications
You must be signed in to change notification settings - Fork 218
/
memtier_benchmark.h
127 lines (115 loc) · 3.42 KB
/
memtier_benchmark.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
* Copyright (C) 2011-2017 Redis Labs Ltd.
*
* This file is part of memtier_benchmark.
*
* memtier_benchmark is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2.
*
* memtier_benchmark is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with memtier_benchmark. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _MEMTIER_BENCHMARK_H
#define _MEMTIER_BENCHMARK_H
#include <vector>
#include "config_types.h"
#ifdef USE_TLS
#include <openssl/ssl.h>
#endif
#define LOGLEVEL_ERROR 0
#define LOGLEVEL_DEBUG 1
#define benchmark_debug_log(...) \
benchmark_log_file_line(LOGLEVEL_DEBUG, __FILE__, __LINE__, __VA_ARGS__)
#define benchmark_error_log(...) \
benchmark_log(LOGLEVEL_ERROR, __VA_ARGS__)
enum key_pattern_index {
key_pattern_set = 0,
key_pattern_delimiter = 1,
key_pattern_get = 2
};
enum PROTOCOL_TYPE {
PROTOCOL_REDIS_DEFAULT,
PROTOCOL_RESP2,
PROTOCOL_RESP3,
PROTOCOL_MEMCACHE_TEXT,
PROTOCOL_MEMCACHE_BINARY,
};
struct benchmark_config {
const char *server;
unsigned short port;
struct server_addr *server_addr;
const char *unix_socket;
int resolution;
enum PROTOCOL_TYPE protocol;
const char *out_file;
const char *client_stats;
unsigned int run_count;
int debug;
int show_config;
int hide_histogram;
config_quantiles print_percentiles;
int distinct_client_seed;
int randomize;
int next_client_idx;
unsigned long long requests;
unsigned int clients;
unsigned int threads;
unsigned int test_time;
config_ratio ratio;
unsigned int pipeline;
unsigned int data_size;
unsigned int data_offset;
bool random_data;
struct config_range data_size_range;
config_weight_list data_size_list;
const char *data_size_pattern;
struct config_range expiry_range;
const char *data_import;
int data_verify;
int verify_only;
int generate_keys;
const char *key_prefix;
unsigned long long key_minimum;
unsigned long long key_maximum;
double key_stddev;
double key_median;
const char *key_pattern;
unsigned int reconnect_interval;
int multi_key_get;
const char *authenticate;
int select_db;
bool no_expiry;
bool resolve_on_connect;
// WAIT related
config_ratio wait_ratio;
config_range num_slaves;
config_range wait_timeout;
// JSON additions
const char *json_out_file;
bool cluster_mode;
struct arbitrary_command_list* arbitrary_commands;
const char *hdr_prefix;
unsigned int request_rate;
unsigned int request_per_interval;
unsigned int request_interval_microsecond;
#ifdef USE_TLS
bool tls;
const char *tls_cert;
const char *tls_key;
const char *tls_cacert;
bool tls_skip_verify;
const char *tls_sni;
int tls_protocols;
SSL_CTX *openssl_ctx;
#endif
};
extern void benchmark_log_file_line(int level, const char *filename, unsigned int line, const char *fmt, ...);
extern void benchmark_log(int level, const char *fmt, ...);
bool is_redis_protocol(enum PROTOCOL_TYPE type);
#endif /* _MEMTIER_BENCHMARK_H */