Commit Graph

186 Commits

Author SHA1 Message Date
Paweł Dziepak
51e98e0e11 tests/perf_fast_forward: report average number of aio operations
perf_fast_forward is used to detect performance regressions. The two
main metrics used for this are fargments per second and the number of
the IO operations. The former is a median of a several runs, but the
latter is just the actual number of asynchronous IO operations performed
in the run that happened to be picked as a median frag/s-wise. There's
no always a direct correlation between frag/s and aio and the latter can
vary which makes the latter hard to compare.

In order to make this easier a new metric was introduced: "average aio"
which reports the average number of asynchronous IO operations performed
in a run. This should produce much more stable results and therefore
make the comparison more meaningful.
Message-Id: <20190430134401.19238-1-pdziepak@scylladb.com>
2019-05-06 11:47:31 +02:00
Benny Halevy
ff4d8b6e85 treewide: use std::filesystem
Rather than {std::experimental,boost,seastar::compat}::filesystem

On Sat, 2019-03-23 at 01:44 +0200, Avi Kivity wrote:
> The intent for seastar::compat was to allow the application to choose
> the C++ dialect and have seastar follow, rather than have seastar choose
> the types and have the application follow (as in your patch).

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-03-28 14:21:10 +02:00
Avi Kivity
a77762b02a Merge "Optimise vint deserialisation" from Paweł
"

Variable length integers are used are used extensively by SSTables mc
format. The current deserialisation routine is quite naive in a way that
it reads each byte separately. Since, those vints usually appear inside
much larger buffers, we optimise for such cases, read 8-bytes at once
and then mask out the unneeded parts (as well as fix their order because
big-endian).

Tests: unit(dev).

perf_vint (average time per element when deserializing 1000 vints):

before:
vint.deserialize                            69442000    14.400ns     0.000ns    14.399ns    14.400ns

after:
vint.deserialize                           241502000     4.140ns     0.000ns     4.140ns     4.140ns

perf_fast_forward (data on /tmp):
large-partition-single-key-slice on dataset large-part-ds1:

before:
   range            time (s)   iterations     frags     frag/s    mad f/s    max f/s    min f/s    aio      (KiB) blocked dropped  idx hit idx miss  idx blk    c hit   c miss    c blk    cpu
-> [0, 1]           0.000278         8792         2       7190        119       7367       1960      3        104       2       0        0        1        1        0        0        1 100.0%
-> [1, 100)         0.000344           96        99     288100       4335     307689     193809      2        108       2       0        0        1        1        0        0        1 100.0%
-> (100, 200]       0.000339        13254       100     295263       2824     301734     222725      2        108       2       0        0        1        1        0        0        1 100.0%

after:
   range            time (s)   iterations     frags     frag/s    mad f/s    max f/s    min f/s    aio      (KiB) blocked dropped  idx hit idx miss  idx blk    c hit   c miss    c blk    cpu
-> [0, 1]           0.000236        10001         2       8461         59       8718       2261      3        104       2       0        0        1        1        0        0        1 100.0%
-> [1, 100)         0.000285           89        99     347500       2441     355826     215745      2        108       2       0        0        1        1        0        0        1 100.0%
-> (100, 200]       0.000293        14369       100     341302       1512     350123     222049      2        108       2       0        0        1        1        0        0        1 100.0%
"

* tag 'optimise-vint/v2' of https://github.com/pdziepak/scylla:
  sstable: pass full length of buffer to vint deserialiser
  vint: optimise deserialisation routine
  vint: drop deserialize_type structure
  tests/vint: reduce test dependencies
  tests/perf: add performance test for vint serialisation
2019-03-26 16:41:44 +02:00
Benny Halevy
2cd11208a1 tests: use global nop_lp_handler in test_services
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-03-26 16:05:08 +02:00
Paweł Dziepak
54a079cdb5 tests/perf: add performance test for vint serialisation 2019-03-14 13:37:06 +00:00
Paweł Dziepak
0ba7a3c55a tests/perf_fast_forward: add script for analysing full results
perf_fast_forward with flag --dump-all-results reports the results of
every test iteration that was executed. This patch introduces a python
script that can analyse those results (in json format) and present them
in a more human-friendly way.

For now, the only option is to plot histograms of selected statistics.
2019-03-06 15:48:49 +00:00
Paweł Dziepak
4220b90b22 tests/perf_fast_forward: add an option to dump all results
perf_fast_forward runs each test case multiple times and reports a
summary of those results (median, min, max, and median absolute
deviation).

While very convenient the summary may hide some important information
(e.g. the distribution of the results). This patch adds an option to
report results of every single executed iteration.
2019-03-06 15:48:48 +00:00
Paweł Dziepak
55ed8b2472 tests/perf_fast_forward: extract json result file writing logic
We are about to report, depending on flags, both full results as well as
the results summary written now. Most of the logic is going to be
identical.
2019-03-06 15:48:45 +00:00
Paweł Dziepak
daafde21c5 tests/perf_fast_forward: reuse keys in small partition slicing test 2019-03-06 15:48:42 +00:00
Paweł Dziepak
0eb1e570aa tests/perf_fast_forward: print number of iterations of each test 2019-03-06 15:48:38 +00:00
Paweł Dziepak
5d5777f85e tests/perf_fast_forward: disable partition-level fast-forwarding if not needed
Several of the test cases in perf_fast_forward do not need
partition-level fast-forwarding. However, since the defaults are used to
construct most of the readers the fast-forwarding is enabled regardless.

This showed an apparent regression in the perf_fast_forward results
after adcb3ec20c ("row_cache: read is not
single-partition if inter-partition forwarding is enabled") which
disabled an optimisation that was invalid when partition-level
fast-forwarind was requested.

This patch ensures that all single-partition reads that do not need
partition-level fast-forwarding keep it disabled.
2019-02-22 14:28:02 +00:00
Benny Halevy
c8f239ff2b tests: introduce sstables::test_env
In preparation to adding sstables_manager we want
to establish an environment for testing sstables.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-02-14 22:37:41 +02:00
Benny Halevy
f9546b23b7 tests: perf_sstable: rename test_env
test_env is going to be a class in sstables namespace

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-02-14 22:22:15 +02:00
Benny Halevy
b0f3f8d766 tests: sstables::test::make_test_sstable: reorder params
In preparation for providing a default large_data_handler in
a test-standard way.

buffer_size parameter reordered and now has a default value
same as make_sstable()'s.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-02-14 22:21:36 +02:00
Avi Kivity
468f8c7ee7 Merge "Print a warning if a row is too large" from Rafael
"
This is a first step in fixing #3988.
"

* 'espindola/large-row-warn-only-v4' of https://github.com/espindola/scylla:
  Rename large_partition_handler
  Print a warning if a row is too large
  Remove defaut parameter value
  Rename _threshold_bytes to _partition_threshold_bytes
  keys: add schema-aware printing for clustering_key_prefix
2019-02-03 13:57:42 +02:00
Rafael Ávila de Espíndola
625080b414 Rename large_partition_handler
Now that it also handles large rows, rename it to large_data_handler.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
2019-01-28 15:03:14 -08:00
Paweł Dziepak
335dca54a5 perf_simple_query: produce json results 2019-01-28 16:36:06 +00:00
Paweł Dziepak
7d21c9c31f perf_simple_query: calculate and print statistics 2019-01-28 16:36:06 +00:00
Paweł Dziepak
eb3d80fa2b perf: time_parallel: return results of each iteration 2019-01-28 16:35:33 +00:00
Paweł Dziepak
6a1e1e8454 perf_simple_query: take advantage of threads in main() 2019-01-28 13:21:08 +00:00
Asias He
ee0bb0aa94 tests: Drop the unsupported random_read mode in perf_sstable
It is not supported. Remove it.
Message-Id: <fe31e090574be96a9620b6902ceb843699d558d0.1548403105.git.asias@scylladb.com>
2019-01-25 14:24:40 +00:00
Tomasz Grabiec
e02baabd62 tests: perf_fast_forward: Introduce --with-compression option
Message-Id: <1547819062-4369-1-git-send-email-tgrabiec@scylladb.com>
2019-01-21 12:18:31 +00:00
Tomasz Grabiec
c422bfc2c5 tests: perf_fast_forward: Store results for each dataset in separate sub-directory
Otherwise read test results for subsequent datasets will override each other.

Also, rename population test case to not include dataset name, which
is now redundant.

Message-Id: <1547822942-9690-1-git-send-email-tgrabiec@scylladb.com>
2019-01-20 15:38:46 +02:00
Duarte Nunes
fa2b0384d2 Replace std::experimental types with C++17 std version.
Replace stdx::optional and stdx::string_view with the C++ std
counterparts.

Some instances of boost::variant were also replaced with std::variant,
namely those that called seastar::visit.

Scylla now requires GCC 8 to compile.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
Message-Id: <20190108111141.5369-1-duarte@scylladb.com>
2019-01-08 13:16:36 +02:00
Tomasz Grabiec
b78d98a358 tests: perf_fast_forward: Fix result_collector::add() for multi-element results
The results vector should be populated vertically, not horizontally.

Responsible for assertion failure with --cache-enabled:

  void result_collector::add(test_result_vector): Assertion `rs.size() == results.size()' failed.

Introduced in 3fc78a25bf.
Message-Id: <1544105835-24530-2-git-send-email-tgrabiec@scylladb.com>
2018-12-07 12:44:32 +00:00
Tomasz Grabiec
10cde9ae50 tests: perf_fast_forward: Fix live_range not being initialized
Broken in 470552b7ab

Causes test failure when running with --cache-enabled
Message-Id: <1544105835-24530-1-git-send-email-tgrabiec@scylladb.com>
2018-12-07 12:38:01 +00:00
Tomasz Grabiec
2c2d202354 tests: perf_fast_forward: Make output directory configurable
Message-Id: <1544020034-16340-1-git-send-email-tgrabiec@scylladb.com>
2018-12-05 21:51:01 +02:00
Tomasz Grabiec
247347058c tests: perf_fast_forward: Always print to stdout
Otherwise errors cannot be made sense of, since error are reported
always to stdout. Without test output we don't know what they're
referring to.

This change makes the output always go to stdout, in addition to other
reportes, if any.
Message-Id: <1544020084-16492-1-git-send-email-tgrabiec@scylladb.com>
2018-12-05 21:51:01 +02:00
Avi Kivity
b098b5b987 Merge "Optimize checksum_combine() for CRC32" from Tomek
"
zlib's crc32_combine() is not very efficient. It is faster to re-combine
the buffer using crc32(). It's still substantial amount of work which
could be avoided.

This patch introduces a fast implementation of crc32_combine() which
uses a different algorithm than zlib. It also utilizes intrinsics for
carry-less multiplication instruction to perform the computation faster.
The details of the algorithm can be found in code comments.

Performance results using perf_checksum and second buffer of length 64 KiB:

zlib CRC32 combine:   38'851   ns
libdeflate CRC32:      4'797   ns
fast_crc32_combine():     11   ns

So the new implementation is 3500x faster than zlib's, and 417x faster than
re-checksumming the buffer using libdeflate.

Tested on i7-5960X CPU @ 3.00GHz

Performance was also evaluated using sstable writer benchmark:

  perf_fast_forward --populate --sstable-format=mc --data-directory /tmp/perf-mc \
     --value-size=10000 --rows 1000000 --datasets small-part

It yielded 9% improvement in median frag/s (129'055 vs 117'977).

Refs #3874
"

* tag 'fast-crc32-combine-v2' of github.com:tgrabiec/scylla:
  tests: perf_checksum: Test fast_crc32_combine()
  tests: Rename libdeflate_test to checksum_utils_test
  tests: libdeflate: Add more tests for checksum_combine()
  tests: libdeflate: Check both libdeflate and default checksummers
  sstables: Use fast_crc_combine() in the default checksummer
  utils/gz: Add fast implementation of crc32_combine()
  utils/gz: Add pre-computed polynomials
  utils/gz: Import Barett reduction implementation from libdeflate
  utils: Extract clmul() from crc.hh
2018-12-03 19:02:01 +02:00
Tomasz Grabiec
feefb23232 tests: perf_checksum: Test fast_crc32_combine() 2018-12-03 14:40:35 +01:00
Benny Halevy
857ff4f59a database: directly use std::experimental::filesystem::path for lister::path
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2018-12-02 22:02:10 +02:00
Tomasz Grabiec
f1a35b654a tests: perf: Introduce perf_checksum 2018-11-26 18:59:43 +01:00
Paweł Dziepak
13385778fd Merge "Measure performance of dataset population in perf_fast_forward" from Tomasz
* tag 'perf-ffwd-dataset-population-v2' of github.com:tgrabiec/scylla:
  tests: perf_fast_forward: Measure performance of dataset population
  tests: perf_fast_forward: Record the dataset on which test case was run
  tests: perf_fast_forward: Introduce the concept of a dataset
  tests: perf_fast_forward: Introduce make_compaction_disabling_guard()
  tests: perf_fast_forward: Initialize output manager before population
  tests: perf_fast_forward: Handle empty test parameter set
  tests: perf_fast_forward: Extract json_output_writer::write_common_test_group()
  tests: perf_fast_forward: Factor out access to cfg to a single place per function
  tests: perf_fast_forward: Extract result_collector
  tests: perf_fast_forward: Take writes into account in AIO statistics
  tests: perf_fast_forward: Reorder members
  tests: perf_fast_forward: Add --sstable-format command line option
2018-11-26 09:45:55 +00:00
Raphael S. Carvalho
e5a0b05c15 sstables/compaction: release space earlier of exhausted input sstables
Currently, compaction only replace input sstables at end of compaction,
meaning compaction must be finished for all the space of those sstables
to be released.

What we can do instead is to delete earlier some input sstable under
some conditions:

1) SStable data should be committed to a new, sealed output sstable,
meaning it's exhausted.
2) Exhausted sstable mustn't overlap with a non-exhausted sstable
because a tombstone in the exhausted could have been purged and the
shadowed data in non-exhausted could be ressurected if system
crashes.

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
2018-11-24 18:53:07 -02:00
Tomasz Grabiec
8e93046abc tests: perf_fast_forward: Measure performance of dataset population 2018-11-23 19:22:50 +01:00
Tomasz Grabiec
2c95aa4d8d tests: perf_fast_forward: Record the dataset on which test case was run
Now any given test case can potentially run on many different datasets.
2018-11-23 19:22:12 +01:00
Tomasz Grabiec
470552b7ab tests: perf_fast_forward: Introduce the concept of a dataset
A dataset represents a table with data, populated in certain way, with
certain characteristics of the schema and data.

Before this change, datasets were implicitly defined, with population
hard-coded inside the populate() function.

This change gathers logic related to datasets into classes, in order to:

  - make it easier to define new datasets.

  - be able to measure performance of dataset population in a
    standardized way.

  - being able to express constraints on datasets imposed by different
    test cases.  Test cases are matched with possible datasets based
    on the abstract interface they accept (e.g. clustered_ds,
    multipartition_ds), and which must be implemented by a compatible
    dataset. To facilitate this matching, test function is now wrapped
    into a dataset_acceptor object, with an automatically-generated can_run()
    virtual method, deduced by make_test_fn().

  - be able to select tests to run based on the dataset name.
    Only tests which are compatible with that dataset will be run.
2018-11-23 19:22:09 +01:00
Tomasz Grabiec
2746f78a9f tests: perf_fast_forward: Introduce make_compaction_disabling_guard() 2018-11-23 19:18:10 +01:00
Tomasz Grabiec
b00d360281 tests: perf_fast_forward: Initialize output manager before population 2018-11-23 19:18:10 +01:00
Tomasz Grabiec
25dc481030 tests: perf_fast_forward: Handle empty test parameter set 2018-11-23 19:18:10 +01:00
Tomasz Grabiec
38a1b7e87b tests: perf_fast_forward: Extract json_output_writer::write_common_test_group() 2018-11-23 19:18:10 +01:00
Tomasz Grabiec
a507ca8159 tests: perf_fast_forward: Factor out access to cfg to a single place per function
Preparatory change before making n_rows be determined through a
dataset object.
2018-11-23 19:18:09 +01:00
Tomasz Grabiec
3fc78a25bf tests: perf_fast_forward: Extract result_collector
Extracts the result collection and reporting logic out of
run_test_case(). Will be needed in population tests, for which we
don't want the looping logic.
2018-11-23 19:18:09 +01:00
Tomasz Grabiec
f4a70283ee tests: perf_fast_forward: Take writes into account in AIO statistics
Relevant for population tests. So far all tests were read tests.
2018-11-23 19:18:09 +01:00
Tomasz Grabiec
96f5bd2f46 tests: perf_fast_forward: Reorder members 2018-11-23 19:18:09 +01:00
Tomasz Grabiec
3ac5e8887e tests: perf_fast_forward: Add --sstable-format command line option 2018-11-23 19:18:09 +01:00
Avi Kivity
775b7e41f4 Update seastar submodule
* seastar d59fcef...b924495 (2):
  > build: Fix protobuf generation rules
  > Merge "Restructure files" from Jesse

Includes fixup patch from Jesse:

"
Update Seastar `#include`s to reflect restructure

All Seastar header files are now prefixed with "seastar" and the
configure script reflects the new locations of files.

Signed-off-by: Jesse Haber-Kucharsky <jhaberku@scylladb.com>
Message-Id: <5d22d964a7735696fb6bb7606ed88f35dde31413.1542731639.git.jhaberku@scylladb.com>
"
2018-11-21 00:01:44 +02:00
Avi Kivity
f70ece9f88 tests: convert sprint() to format()
sprint() recently became more strict, throwing on sprint("%s", 5). Replace
with the more modern format().

Mechanically converted with https://github.com/avikivity/unsprint.
2018-11-01 13:16:17 +00:00
Avi Kivity
8ca4b7abea tests: perf_fast_forward: rename "format" variable
The format local variable will soon alias with the format function which we
intend to use in the same context. Rename it away to avoid a clash.
2018-11-01 13:16:17 +00:00
Avi Kivity
7908f09148 tests: perf_fast_forward: massage result of sprint() into std::string
sprint() returns std::string(), but the new format() returns an sstring. Usually
an sstring is wanted but in this case an sstring will fail as it is added to
an std::string.

Fix the failure (after spring->format conversion) by converting to an std::string.
2018-11-01 13:16:17 +00:00