Skip to content
Snippets Groups Projects
  1. Oct 03, 2023
    • Sergey Bronnikov's avatar
      ci: run performance tests · 5edcb712
      Sergey Bronnikov authored
      Performance tests added to perf directory are not automated and
      currently we run these tests manually from time to time. From other side
      source code that used rarely could lead to software rot [1].
      
      The patch adds CMake target "test-perf" and GitHub workflow, that runs
      these tests in CI. Workflow is based on workflow release.yml, it builds
      performance tests and runs them.
      
      1. https://en.wikipedia.org/wiki/Software_rot
      
      NO_CHANGELOG=testing
      NO_DOC=testing
      NO_TEST=testing
      5edcb712
    • Sergey Bronnikov's avatar
      perf: add targets for running C performance tests · 68623381
      Sergey Bronnikov authored
      The patch adds a targets for each C performance test in a directory
      perf/ and a separate target "test-c-perf" that runs all C performance
      tests at once.
      
      NO_CHANGELOG=testing
      NO_DOC=testing
      NO_TEST=test infrastructure
      68623381
    • Sergey Bronnikov's avatar
      perf: add targets for running Lua performance tests · 49d9a874
      Sergey Bronnikov authored
      The patch adds a targets for each Lua performance test in a directory
      perf/lua/ (1mops_write_perftest, box_select_perftest,
      uri_escape_unescape_perftest) and a separate target "test-lua-perf" that
      runs all Lua performance tests at once.
      
      NO_CHANGELOG=testing
      NO_DOC=testing
      NO_TEST=test infrastructure
      49d9a874
  2. Sep 29, 2023
    • Magomed Kostoev's avatar
      box: implement sort_order in indexes · b1990b21
      Magomed Kostoev authored
      The `sort_order` parameter was introduced earlier but had no effect
      until now. Now it allows to specify a sort (iteration) order for
      each key part.
      
      The parameter is only applicable to ordered indexes, so any value
      except 'undef' for the `sort_order` is disallowed for all indexes
      except TREE. The 'undef' value of the `sort_order` field of the
      `key_part_def` is translated to 'asc' on `key_part` creation.
      
      In order to make the key def aware if its index is unordered, the
      signature of `key_def_new` has been changed: the `for_func_index`
      parameter has been moved to the new `flags` parameter and
      `is_unordered` flag has been introduced.
      
      Alternative iterator names has been introduced (which are aliases
      to regular iterators): box.index.FORWARD_[INCLUSIVE/EXCLUSIVE],
      box.index.REVERSE_[INCLUSIVE/EXCLUSIVE].
      
      By the way fixed the `key_hint_stub` overload name, which supposed
      to be called `tuple_hint_stub`.
      
      `tuple_hint` and `key_hint` template declarations has been changed
      because of the checkpatch diagnostics.
      
      Closes #5529
      
      @TarantoolBot document
      Title: Now it's possible to specify sort order of each index part.
      
      Sort order specifies the way indexes iterate over tuples with
      different fields in the same part. It can be either ascending
      (which is the case by default) and descending.
      
      Tuples with different ascending parts are sorted in indexes from
      lesser to greater, whereas tuples with different descending parts
      are sorted in the opposte order: from greater to lesser.
      
      Given example:
      
      ```lua
      box.cfg{}
      
      s = box.schema.create_space('tester')
      pk = s:create_index('pk', {parts = {
        {1, 'unsigned', sort_order = 'desc'},
        {2, 'unsigned', sort_order = 'asc'},
        {3, 'unsigned', sort_order = 'desc'},
      }})
      
      s:insert({1, 1, 1})
      s:insert({1, 1, 2})
      s:insert({1, 2, 1})
      s:insert({1, 2, 2})
      s:insert({2, 1, 1})
      s:insert({2, 1, 2})
      s:insert({2, 2, 1})
      s:insert({2, 2, 2})
      s:insert({3, 1, 1})
      s:insert({3, 1, 2})
      s:insert({3, 2, 1})
      s:insert({3, 2, 2})
      ```
      
      In this case field 1 and 3 are descending, whereas field 2 is
      ascending. So `s:select()` will return this result:
      
      ```yaml
      ---
      - [3, 1, 2]
      - [3, 1, 1]
      - [3, 2, 2]
      - [3, 2, 1]
      - [2, 1, 2]
      - [2, 1, 1]
      - [2, 2, 2]
      - [2, 2, 1]
      - [1, 1, 2]
      - [1, 1, 1]
      - [1, 2, 2]
      - [1, 2, 1]
      ...
      ```
      
      Beware, that when using other sort order than 'asc' for any field
      'GE', 'GT', 'LE' and 'LT' iterator lose their meaning and specify
      'forward inclusive', 'forward exclusive', 'reverse inclusive' and
      'reverse exclusive' iteration direction respectively. Given example
      above, `s:select({2}, {iterator = 'GT'})` will return this:
      
      ```yaml
      ---
      - [1, 1, 2]
      - [1, 1, 1]
      - [1, 2, 2]
      - [1, 2, 1]
      ...
      ```
      
      And `s:select({1}, {iterator = 'LT'})` will give us:
      
      ```yaml
      ---
      - [2, 2, 1]
      - [2, 2, 2]
      - [2, 1, 1]
      - [2, 1, 2]
      - [3, 2, 1]
      - [3, 2, 2]
      - [3, 1, 1]
      - [3, 1, 2]
      ...
      ```
      
      In order to be more clear alternative iterator aliases can be used:
      'FORWARD_INCLUSIVE', 'FORWARD_EXCLUSIVE', 'REVERSE_INCLUSIVE',
      'REVERSE_EXCLUSIVE':
      
      ```
      > s:select({1}, {iterator = 'REVERSE_EXCLUSIVE'})
      ---
      - [2, 2, 1]
      - [2, 2, 2]
      - [2, 1, 1]
      - [2, 1, 2]
      - [3, 2, 1]
      - [3, 2, 2]
      - [3, 1, 1]
      - [3, 1, 2]
      ...
      ```
      b1990b21
  3. Aug 08, 2023
    • Sergey Ostanevich's avatar
      perf: initial version of 1M operations test · 10870343
      Sergey Ostanevich authored
      The test can be used for regression testing. It is advisable to tune
      the machine: check the NUMA configuration, fix the pstate or similar
      CPU autotune. Although, running dozen times gives more-less stable
      result for the peak performance, that should be enough for regression
      identification.
      
      NO_DOC=adding an internal test
      NO_CHANGELOG=ditto
      NO_TEST=ditto
      10870343
  4. Jul 25, 2023
    • Vladimir Davydov's avatar
      perf: add test for box select · 114d09f5
      Vladimir Davydov authored
      The test runs get, select, pairs space methods with various arguments in
      a loop and prints the average method run time in nanoseconds (lower is
      better).
      
      Usage:
      
        tarantool box_select.lua
      
      Output format:
      
        <test-case> <run-time>
      
      Example:
      
        $ tarantool box_select.lua --pattern 'get|select_%d$'
        get_0 155
        get_1 240
        select_0 223
        select_1 335
        select_5 2321
      
      Options:
      
        --pattern <string>  run only tests matching the pattern; use '|'
                            to specify more than one pattern, for example,
                            'get|select'
        --read_view         use a read view (EE only)
      
      Apart from the test, this patch also adds a script that compares test
      results:
      
        $ tarantool box_select.lua --pattern get > base
        $ tarantool box_select.lua --pattern get > patched1
        $ tarantool box_select.lua --pattern get > patched2
        $ tarantool compare.lua base patched1 patched2
               base          patched1          patched2
        get_0   149       303 (+103%)       147 (-  1%)
        get_1   239       418 (+ 74%)       238 (-  0%)
      
      NO_DOC=perf test
      NO_TEST=perf test
      NO_CHANGELOG=perf test
      114d09f5
  5. Mar 23, 2023
  6. Jan 24, 2023
    • Sergey Bronnikov's avatar
      perf/cmake: add a function for generating perf test targets · ca58d6c9
      Sergey Bronnikov authored
      Commit 2be74a65 ("test/cmake: add a function for generating unit
      test targets") added a function for generating unit test targets in
      CMake. This function makes code simpler and less error-prone.
      
      Proposed patch adds a similar function for generating performance test
      targets in CMake.
      
      NO_CHANGELOG=build infrastructure updated
      NO_DOC=build infrastructure updated
      NO_TEST=build infrastructure updated
      ca58d6c9
  7. Dec 27, 2022
    • Sergey Bronnikov's avatar
      perf: add uri.escape/unescape test · 3cc0b3cf
      Sergey Bronnikov authored
      Added a simple benchmark for URI escape/unescape.
      
      Part of #3682
      
      NO_DOC=documentation is not required for performance test
      NO_CHANGELOG=performance test
      NO_TEST=performance test
      3cc0b3cf
  8. Aug 26, 2022
    • Nikita Pettik's avatar
      perf: introduce Light benchmark · 9818bba4
      Nikita Pettik authored
      Benchmark is implemented using Google Benchmark lib. Here's benchmark
      settings:
       - values: we use structure (tuple) containing pointer to heap memory
                 and size (all payload is of the same size - 32 bytes);
       - keys: unsigned char (first byte in the tuple memory);
       - hash function: FNV-1a;
       - value comparator: std::memcmp();
       - value count: 10k - 100k - 1M
      
      Before each test we prepare vector of tuples storing truly random
      values.
      
      Here's the list of results obtained on my PC (i7-8700 12 X 4600 MHz):
      
      Insertions: ~20-12M per second;
      Find (no misses): ~58-16M* per second (find by key gives the same result);
      Find (many misses): ~84-30M per second;
      Iteration with dereference: ~450M per second;
      Insertions after erase: ~50-17M* per second;
      Find after erase: ~52-17M* per second (the same as without erase);
      Delete: ~32-8M* per second.
      
      * The first value is for 10k values in hash table; second - is for 1M.
      
      Just to have some baseline here results for quite similar benchmark for
      std::unordered_map (it is also included in source file):
      
      Insertions: ~26-8M per second;
      Find (no misses): ~44-11M per second;
      Iteration with dereference: ~265-56M per second;
      Find after erase: ~37-13M per second.
      
      Part of #7338
      
      NO_TEST=<Benchmark>
      NO_DOC=<Benchmark>
      NO_CHANGELOG=<Benchmark>
      9818bba4
    • Nikita Pettik's avatar
      perf: use C++ 14 standard · e48835fd
      Nikita Pettik authored
      There are a lot of pretty things introduced in 14 standard,
      so let's use it.
      
      NO_DOC=<Build change>
      NO_TEST=<Build change>
      NO_CHANGELOG=<Build change>
      e48835fd
    • Nikita Pettik's avatar
      perf: move debug warning to a separate header · 0a7764a7
      Nikita Pettik authored
      It's useful and can be used in all performance tests, so let's move it
      to a separate header.
      
      NO_TEST=<Refactoring>
      NO_DOC=<Refactoring>
      NO_CHANGELOG=<Refactoring>
      0a7764a7
  9. Jun 28, 2022
    • Nikita Pettik's avatar
      tuple: refactor flags · 9da70207
      Nikita Pettik authored
      Before this patch struct tuple had two boolean bit fields: is_dirty and
      has_uploaded_refs. It is worth mentioning that sizeof(boolean) is
      implementation depended. However, in code it is assumed to be 1 byte
      (there's static assertion restricting the whole struct tuple size by 10
      bytes). So strictly speaking it may lead to the compilation error on
      some non-conventional system. Secondly, bit fields anyway consume at
      least one size of type (i.e. there's no space benefits in using two
      uint8_t bit fields - they anyway occupy 1 byte in total). There are
      several known pitfalls concerning bit fields:
       - Bit field's memory layout is implementation dependent;
       - sizeof() can't be applied to such members;
       - Complier may raise unexpected side effects
         (https://lwn.net/Articles/478657/).
      
      Finally, in our code base as a rule we use explicit masks:
      txn flags, vy stmt flags, sql flags, fiber flags.
      
      So, let's replace bit fields in struct tuple with single member called
      `flags` and several enum values corresponding to masks (to be more
      precise - bit positions in tuple flags).
      
      NO_DOC=<Refactoring>
      NO_CHANGELOG=<Refactoring>
      NO_TEST=<Refactoring>
      9da70207
  10. May 18, 2022
    • Serge Petrenko's avatar
      replication: fix race in accessing vclock by applier and tx threads · ddec704e
      Serge Petrenko authored
      When applier ack writer was moved to applier thread, it was overlooked
      that it would start sharing replicaset.vclock between two threads.
      
      This could lead to the following replication errors on master:
      
       relay//102/main:reader V> Got a corrupted row:
       relay//102/main:reader V> 00000000: 81 00 00 81 26 81 01 09 02 01
      
      Such a row has an incorrectly-encoded vclock: `81 01 09 02 01`.
      When writer fiber encoded the vclock length (`81`), there was only one
      vclock component: {1: 9}, but at the moment of iterating over the
      components, another WAL write was reported to TX thread, which bumped
      the second vclock component {1: 9, 2: 1}.
      
      Let's fix the race by delivering a copy of current replicaset vclock to
      the applier thread.
      
      Also add a perf test to the perf/ directory.
      
      Closes #7089
      Part-of tarantool/tarantool-qa#166
      
      NO_DOC=internal fix
      NO_TEST=hard to test
      ddec704e
  11. Mar 24, 2022
    • Aleksandr Lyapunov's avatar
      box: introduce a pair of tuple_format_new helpers · 4b8dc6b7
      Aleksandr Lyapunov authored
      tuple_format_new has lots of arguments, all of them necessary
      indeed. But a small analysss showed that almost always there are
      only two kinds of usage of that function: with lots of zeros as
      arguments and lots of values taken from space_def.
      
      Make two versions of tuple_format_new:
      simple_tuple_format_new, with all those zeros omitted, and
      space_tuple_format_new, that takes space_def as an argument.
      
      NO_DOC=refactoring
      NO_CHANGELOG=refactoring
      4b8dc6b7
  12. Mar 23, 2022
  13. Mar 03, 2022
    • mechanik20051988's avatar
      alter: implement ability to set compression for tuple fields · a51313a4
      mechanik20051988 authored
      Implement ability to set compression for tuple fields. Compression type
      for tuple fields is set in the space format, and can be set during space
      creation or during setting of a new space format.
      ```lua
      format = {{name = 'x', type = 'unsigned', compression = 'none'}}
      space = box.schema.space.create('memtx_space', {format = format})
      space:drop()
      space = box.schema.space.create('memtx_space')
      space:format(format)
      ```
      For opensource build only one compression type ('none') is
      supported. This type of compression means its absence, so
      it doesn't affect something.
      
      Part of #2695
      
      NO_CHANGELOG=stubs for enterprise version
      NO_DOC=stubs for enterprise version
      a51313a4
  14. Feb 03, 2022
    • mechanik20051988's avatar
      test: fix incorrect resource release · 438ce64e
      mechanik20051988 authored
      There were two problems with resource release in performance test:
      - because of manually zeroing of `box_tuple_last`, tuple_format
        structure was not deleted. `box_tuple_last` should be zeroed in
        `tuple_free` function.
      - invalid loop for resource release in one of the test cases.
      This patch fix both problems.
      
      NO_CHANGELOG=test fix
      NO_DOC=test fix
      438ce64e
  15. Dec 09, 2021
  16. Aug 18, 2021
  17. Aug 12, 2021
Loading