Skip to content

Instantly share code, notes, and snippets.

View SpringMT's full-sized avatar

Spring_MT SpringMT

View GitHub Profile
  • vim /etc/sysconfig/varnish
VARNISH_LISTEN_PORT=80
  • vim /etc/varnish/default.vcl
backend default {
@SpringMT
SpringMT / gist:da7eb120744d9d09fa8d
Created September 22, 2014 05:15
htm bench script
require 'benchmark'
r = 1_000_000
rsqr = r*r
iteration = 100_000
threads= []
mutex = Mutex.new
cnt = [0, 0]
puts Benchmark.measure {
@SpringMT
SpringMT / gist:89aa74aad7b76acac2b8
Created September 21, 2014 16:34
core for rujit
% lldb -c /cores/core.96837 ~/src/rujit
warning: (x86_64) /cores/core.96837 load command 102 LC_SEGMENT_64 has a fileoff + filesize (0x1e06b000) that extends beyond the end of the file (0x1e06a000), the segment will be truncated to match
warning: (x86_64) /cores/core.96837 load command 103 LC_SEGMENT_64 has a fileoff (0x1e06b000) that extends beyond the end of the file (0x1e06a000), ignoring this section
Core file '/cores/core.96837' (x86_64) was loaded.
Process 0 stopped
* thread #1: tid = 0x0000, 0x0000000107acb684 ruby_jit.96837.0.dylib`ruby_jit_0 + 84, stop reason = signal SIGSTOP
frame #0: 0x0000000107acb684 ruby_jit.96837.0.dylib`ruby_jit_0 + 84
ruby_jit.96837.0.dylib`ruby_jit_0 + 84:
-> 0x107acb684: movq (%rbx), %rbx
0x107acb687: testb $0x2, %bl
@SpringMT
SpringMT / gist:1c6ffde6118382769f35
Created September 21, 2014 08:37
sample flamegraph
StackProf.run(mode: :cpu, raw: true, out: 'tmp/stackprof-cpu-sample_raw.dump') do
1000.times do
Rails.configuration.database_configuration
ActiveRecord::Base.establish_connection(
username: 'root',
adapter: 'mysql2',
socket: '/tmp/mysql.sock'
)
end
end
@SpringMT
SpringMT / gist:04fef8fc9d7bdec77894
Created September 20, 2014 16:30
sample stackprof
StackProf.run(mode: :cpu, out: 'tmp/stackprof-cpu-sample.dump') do
1000.times do
Rails.configuration.database_configuration
ActiveRecord::Base.establish_connection(
username: 'root',
adapter: 'mysql2',
socket: '/tmp/mysql.sock'
)
end
end
@SpringMT
SpringMT / gist:2599dee54ab3480a57ab
Last active August 29, 2015 14:06
rujit compile error
% ./configure --prefix=$HOME/.rbenv/versions/rujit
checking build system type... x86_64-apple-darwin13.3.0
checking host system type... x86_64-apple-darwin13.3.0
checking target system type... x86_64-apple-darwin13.3.0
checking for gcc-4.2... no
checking for clang... clang
checking for gcc... (cached) clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
@SpringMT
SpringMT / gist:891481b79cf60b5de595
Created September 19, 2014 16:33
thread bench for gobiesvm
r = 1000000
rsqr = r*r
iteration = 10000
cnt = [0, 0]
16.times do
Thread.new do
iteration.times do
x = rand(2*r) - r
x = x*x
@SpringMT
SpringMT / gist:5d1eb25234c5426ca87c
Last active August 29, 2015 14:06
thread bench for Ruby
require 'benchmark'
r = 1_000_000
rsqr = r*r
iteration = 10_000
threads= []
mutex = Mutex.new
cnt = [0, 0]
puts Benchmark.measure {
### Tested script is below.
```ruby
require 'psych'
puts `ps aux | grep ruby | grep -v grep`
begin
Psych.load(<<EOS)
default: &default
@SpringMT
SpringMT / gist:ee29c28051bf0e940320
Last active August 29, 2015 14:06
Script for mem leak at ruby 2.1.2(using rbenv) and Mac 10.9.4
require 'yaml'
puts `ps aux | grep ruby | grep -v grep`
begin
YAML.load(<<EOS)
default: &default
host: localhost
adapter: mysql2
encoding: utf8mb4