This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Gist to check possible issues with MADV_DONTNEED | |
// For example it does not supported by qemu user | |
// There is a patch for this [1], but it hasn't been applied. | |
// [1]: https://lists.gnu.org/archive/html/qemu-devel/2018-08/msg05422.html | |
#include <sys/mman.h> | |
#include <stdio.h> | |
#include <stddef.h> | |
#include <assert.h> | |
#include <string.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gist for showing that rand() with global lock is slower ~60x times | |
// (came to this for librdkafa random partitioning with producer per group, and eventually program has ~1200 threads) | |
// | |
// $ g++ -DRAND -o rand -O3 -pthread rand.cpp | |
// $ g++ -DRAND_R -o rand_r -O3 -pthread rand.cpp | |
// | |
// $ time ./rand | |
// | |
// real 0m2.336s | |
// user 0m2.685s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# XXX: cannot use expect since we need two clients | |
# XXX: requires bash 4.4+ | |
function assert() | |
{ | |
if ! "$@"; then | |
echo "'$*' failed" >&2 | |
exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select version(); | |
-- ┌─version()───┐ | |
-- │ 20.3.15.133 │ | |
-- └─────────────┘ | |
create table ranges_data engine=Memory() as select number key, number value from numbers(100); | |
create dictionary default.ranges_dict (key UInt64, value UInt64 default 1) primary key key source(clickhouse(host '127.0.0.1' port 9000 table 'ranges_data' db 'default' user 'default' password '')) lifetime(0) layout(cache(size_in_cells 100)); | |
create table dist as system.one engine=Distributed('test_cluster_two_shards', system, one, dictGetUInt64('default.ranges_dict', 'value', toUInt64(dummy))); | |
SELECT * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// https://github.com/aosp-mirror/platform_bionic/blob/master/benchmarks/atomic_benchmark.cpp | |
/* | |
* Copyright (C) 2017 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM system.distribution_queue | |
FORMAT Vertical | |
Query id: bb17b27d-c681-4826-8eb6-607a960414f3 | |
Row 1: | |
────── | |
database: default | |
table: dist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/mman.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <assert.h> | |
#include <string.h> | |
void* mmap_hint() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[global] | |
size=512m | |
blocksize=32k | |
timeout=60 | |
numjobs=1 | |
invalidate=1 ; invalidate page-cache (set it explicitly, even though default is true) | |
[read_mmap] | |
stonewall | |
ioengine=mmap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<yandex> | |
<logger> | |
<level>trace</level> | |
<console>true</console> | |
</logger> | |
<tcp_port>9000</tcp_port> | |
<path>./</path> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// clang++ -O2 -g3 -isystem /src/ch/clickhouse/contrib/boost -fsanitize-memory-track-origins -fsanitize=memory test-msan-3.cpp -o test-msan-3; MSAN_OPTIONS='abort_on_error=1 poison_in_dtor=1' ./test-msan-3 | |
/// clang++ -O2 -g3 -fsanitize-memory-track-origins -fsanitize=memory test-msan-3.cpp -o test-msan-3; MSAN_OPTIONS='abort_on_error=1 poison_in_dtor=1' ./test-msan-3 | |
#include <boost/container/small_vector.hpp> | |
#include <algorithm> | |
template <class T, std::size_t N, | |
typename Allocator = boost::container::new_allocator<T>> | |
using small_vector = boost::container::small_vector<T, N, Allocator>; |