Skip to content

Instantly share code, notes, and snippets.

@alexandrnikitin
alexandrnikitin / install-systemtap-on-centos-7.sh
Created August 11, 2017 14:06
Install systemtap on Centos 7
sudo yum install -y systemtap systemtap-runtime
sudo yum install kernel-debuginfo kernel-debuginfo-common
sudo yum install yum-utils
debuginfo-install kernel-3.10.0-514.21.2.el7.x86_64
sudo yum install -y kernel-devel-$(uname -r)
sudo yum install -y kernel-debuginfo-$(uname -r)
sudo yum install -y kernel-debuginfo-common-$(uname -m)-$(uname -r)
5549592 function calls (5549195 primitive calls) in 1101.296 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.000 0.000 <string>:1(<module>)
1 0.000 0.000 0.000 0.000 <string>:1(DefaultVerifyPaths)
1 0.000 0.000 0.000 0.000 <string>:1(ParseResult)
1 0.000 0.000 0.000 0.000 <string>:1(SplitResult)
1 0.000 0.000 0.000 0.000 <string>:1(_ASN1Object)
DEBUG: s3cmd version 2.0.0
DEBUG: ConfigParser: Reading file '/root/.s3cfg'
DEBUG: ConfigParser: access_key->AK...17_chars...A
DEBUG: ConfigParser: access_token->
DEBUG: ConfigParser: add_encoding_exts->
DEBUG: ConfigParser: add_headers->
DEBUG: ConfigParser: bucket_location->eu-west-1
DEBUG: ConfigParser: ca_certs_file->
DEBUG: ConfigParser: cache_file->
DEBUG: ConfigParser: check_ssl_certificate->True
@alexandrnikitin
alexandrnikitin / jvm-large-heap.sh
Last active July 4, 2019 09:54
JVM Large heap analysis
// install Eclipse Memory Analyzer (MAT)
wget http://www.mirrorservice.org/sites/download.eclipse.org/eclipseMirror/mat/1.6.1/rcp/MemoryAnalyzer-1.6.1.20161125-linux.gtk.x86_64.zip
unzip MemoryAnalyzer-1.6.1.20161125-linux.gtk.x86_64.zip
cd mat/
// add more heap to mat
nano MemoryAnalyzer.ini
// create a dump
su - username // if needed
ps aux | grep java
@alexandrnikitin
alexandrnikitin / full-strange-gc.log
Created June 2, 2017 18:15
Strange behavior of G1 GC 1.8.0_131-b11 (G1 GC shrinks number of regions)
This file has been truncated, but you can view the full file.
Java HotSpot(TM) 64-Bit Server VM (25.131-b11) for linux-amd64 JRE (1.8.0_131-b11), built on Mar 15 2017 01:23:40 by "java_re" with gcc 4.3.0 20080428 (Red Hat 4.3.0-8)
Memory: 4k page, physical 263840860k(236794488k free), swap 4194300k(4194300k free)
CommandLine flags: -XX:GCLogFileSize=10485760 -XX:InitialHeapSize=210453397504 -XX:MaxHeapSize=210453397504 -XX:MaxMetaspaceFreeRatio=90 -XX:MetaspaceSize=1073741824 -XX:NumberOfGCLogFiles=5 -XX:+ParallelRefProcEnabled -XX:+PrintAdaptiveSizePolicy -XX:+PrintGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintReferenceGC -XX:+PrintTenuringDistribution -XX:+UseG1GC -XX:+UseGCLogFileRotation
0.629: [G1Ergonomics (Heap Sizing) expand the heap, requested expansion amount: 210453397504 bytes, attempted expansion amount: 210453397504 bytes]
2017-06-02T15:57:18.767+0200: 1.021: Total time for which application threads were stopped: 0.0002004 seconds, Stopping threads took: 0.0000396 seconds
2017-06-02T15:5
@alexandrnikitin
alexandrnikitin / G1
Last active December 5, 2022 19:14
JVM G1 GC flags
-Xms196G
-Xmx196G
-XX:+UseG1GC
-XX:+ParallelRefProcEnabled
-XX:MetaspaceSize=1024M
-XX:MaxMetaspaceFreeRatio=90
-Xloggc:/var/log/service/gc.log
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintReferenceGC

Keybase proof

I hereby claim:

  • I am alexandrnikitin on github.
  • I am alexandrnikitin (https://keybase.io/alexandrnikitin) on keybase.
  • I have a public key ASB7b7pQXfBHdylBlZ0IoI2k6GAVgQCHDLosAjZeMHkUNgo

To claim this, I am signing this object:

@alexandrnikitin
alexandrnikitin / AhoCorasickTree.cs
Created May 1, 2017 18:46
Aho-Corasick with some perf improvements
using System;
using System.Collections.Generic;
namespace Adform.AdServing.AhoCorasickTree.Sandbox.V7g
{
public class AhoCorasickTree
{
internal AhoCorasickTreeNode Root { get; set; }
public AhoCorasickTree(IEnumerable<string> keywords)
0:006> !U /d 00007fff0d5e04d0
Normal JIT generated code
Adform.AdServing.AhoCorasickTree.Benchmarks.ReadingString.TraversalUrolling()
Begin 00007fff0d5e04d0, size 126
>>> 00007fff`0d5e04d0 4883ec28 sub rsp,28h
00007fff`0d5e04d4 33c0 xor eax,eax
00007fff`0d5e04d6 33d2 xor edx,edx
00007fff`0d5e04d8 48b978353a4fde010000 mov rcx,1DE4F3A3578h
00007fff`0d5e04e2 488b09 mov rcx,qword ptr [rcx]
00007fff`0d5e04e5 83790800 cmp dword ptr [rcx+8],0
@alexandrnikitin
alexandrnikitin / AhoCorasickTree.cs
Created April 14, 2017 07:44
Aho-Corasick C# implementation
using System.Collections.Generic;
using System.Linq;
namespace AhoCorasickTree
{
public class AhoCorasickTree
{
internal AhoCorasickTreeNode Root { get; set; }
public AhoCorasickTree(IEnumerable<string> keywords)