Skip to content

Instantly share code, notes, and snippets.

View masaori335's full-sized avatar

Masaori Koshiba masaori335

View GitHub Profile
/** @file
@section license License
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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
@masaori335
masaori335 / benchmark_TsSharedMutex.cc
Created December 6, 2022 01:47
Micro Benchmark of SharedMutex
/** @file
Micro Benchmark tool for TsSharedMutex - requires Catch2 v2.9.0+
- e.g. example of running 64 threads
```
$ taskset -c 0-63 ./benchmark_TsSharedMutex --ts-nthreads 64 --ts-nloop 10000
```
@section license License
@masaori335
masaori335 / http2ssn.uml
Last active July 7, 2021 06:52
HTTP/2 Session and Transaction State
@startuml
title HTTP/2 Session States (v0.4)
hide empty description
[*] --> state_open : start()
state_open --> state_open : VC_EVENT_READ_READY\lVC_EVENT_READ_COMPLETE\lVC_EVENT_WRITE_READY\lVC_EVENT_WRITE_COMPLETE
state_open --> state_aborted : VC_EVENT_EOS\lVC_EVENT_ERROR\lrecv GOAWAY frame with error code
state_aborted --> state_closed : all transaction is done
@masaori335
masaori335 / README.md
Last active March 12, 2020 07:00
Memory consumption of Arena

Memory consumption of Arena

$ ./test_arena_mem 1024 | awk '{sum+=$1; print $1} END {print "----\n" sum}'
1525
----
1525
$ ./test_arena_mem 4096 | awk '{sum+=$1; print $1} END {print "----\n" sum}'
1525
2277
@masaori335
masaori335 / 6313.patch
Created January 28, 2020 07:24
possible fix for #6313
diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc
index f3519c390..e1301cc1e 100644
--- a/proxy/http2/Http2Stream.cc
+++ b/proxy/http2/Http2Stream.cc
@@ -666,15 +666,8 @@ Http2Stream::signal_read_event(int event)
return;
}
- MUTEX_TRY_LOCK(lock, read_vio.cont->mutex, this_ethread());
- if (lock.is_locked()) {
@masaori335
masaori335 / arena_vs_malloc.cc
Created January 22, 2020 06:54
Arena vs malloc/free
/** @file
Compare performance of Arena and malloc/free
@section license License
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
@masaori335
masaori335 / README
Created September 6, 2019 03:00
Test for #5901
Test for #5901 (https://github.com/apache/trafficserver/pull/5901)
nghttp -> POST on HTTP/2 (without content-length) -> ATS -> POST on HTTP/1.1 (Transfer-Encoding: chunked) -> origin (httpbin)
@masaori335
masaori335 / huge_headers.config
Created July 4, 2019 06:58
header_rewrite config to generate huge response headers
cond %{SEND_RESPONSE_HDR_HOOK}
set-header ATS-Req-UUID-00 %{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}
set-header ATS-Req-UUID-01 %{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}
set-header ATS-Req-UUID-02 %{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}
set-header ATS-Req-UUID-03 %{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}
set-header ATS-Req-UUID-04 %{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}
set-header ATS-Req-UUID-05 %{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}
set-header ATS-Req-UUID-06 %{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}
set-header ATS-Req-UUID-07 %{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}
set-header ATS-Req-UUID-08 %{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}%{ID:UNIQUE}
@masaori335
masaori335 / diags.patch
Last active April 3, 2019 06:51
Pretty debug log for Traffic Server
:100644 100644 b34db0256 000000000 M src/tscore/Diags.cc
diff --git a/src/tscore/Diags.cc b/src/tscore/Diags.cc
index b34db0256..4be9f4f17 100644
--- a/src/tscore/Diags.cc
+++ b/src/tscore/Diags.cc
@@ -229,11 +229,11 @@ Diags::print_va(const char *debug_tag, DiagsLevel diags_level, const SourceLocat
format_writer.print(" {}: ", level_name(diags_level));
if (location(loc, show_location, diags_level)) {
@masaori335
masaori335 / example.c
Created May 19, 2012 08:32
An Example of Gauche Extension Module
#include "example.h"
ScmClass* ExampleClass;
static void example_class_print (ScmObj obj, ScmPort* out, ScmWriteContext* ctx)
{
struct example* e = EXAMPLE_UNBOX(obj);
Scm_Printf(out, "#<example-class \"%p\">", e);
}