- vim /etc/sysconfig/varnish
VARNISH_LISTEN_PORT=80
- vim /etc/varnish/default.vcl
backend default {
VARNISH_LISTEN_PORT=80
backend default {
| require 'benchmark' | |
| r = 1_000_000 | |
| rsqr = r*r | |
| iteration = 100_000 | |
| threads= [] | |
| mutex = Mutex.new | |
| cnt = [0, 0] | |
| puts Benchmark.measure { |
| % 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 |
| 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 |
| 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 |
| % ./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... |
| 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 |
| 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 |
| require 'yaml' | |
| puts `ps aux | grep ruby | grep -v grep` | |
| begin | |
| YAML.load(<<EOS) | |
| default: &default | |
| host: localhost | |
| adapter: mysql2 | |
| encoding: utf8mb4 |