This repository has been archived by the owner on Apr 27, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1223 from europeana/release/v3.6.0
Release v3.6.0
- Loading branch information
Showing
7 changed files
with
110 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
# Benchmark script using derailed_benchmarks and a fake API. | ||
|
||
require_relative '../config/boot' | ||
require 'colorize' | ||
require 'open3' | ||
|
||
def bm_common_env | ||
'RAILS_ENV=profiling SKIP_FILE_WRITE=1 EUROPEANA_API_URL=http://localhost:3014/api' | ||
end | ||
|
||
def bm_gems | ||
puts 'Bundled gems'.bold | ||
puts | ||
stdout, _stderr, _status = Open3.capture3('bundle exec derailed bundle:mem') | ||
puts stdout.split("\n").first.sub('TOP: ', '') | ||
puts | ||
end | ||
|
||
def bm_objects(name, path) | ||
puts "#{name}: Objects".bold | ||
puts | ||
cmd = %(#{bm_common_env} TEST_COUNT=10 PATH_TO_HIT="#{path}" bundle exec derailed exec perf:objects) | ||
stdout, stderr, status = Open3.capture3(cmd) | ||
fail "Unable to benchmark objects\n#{stderr}" unless status.success? | ||
puts stdout.split("\n")[0..4].join("\n") | ||
puts | ||
end | ||
|
||
def bm_ips(name, path) | ||
puts "#{name}: IPS".bold | ||
puts | ||
cmd = %(#{bm_common_env} TEST_COUNT=1_000 PATH_TO_HIT="#{path}" bundle exec derailed exec perf:ips) | ||
stdout, stderr, status = Open3.capture3(cmd) | ||
fail "Unable to benchmark IPS\n#{stderr}" unless status.success? | ||
puts stdout | ||
puts | ||
end | ||
|
||
def bm_path(name, path) | ||
bm_objects(name, path) | ||
bm_ips(name, path) | ||
end | ||
|
||
def fake_api_dir | ||
@fake_api_dir ||= File.expand_path('../spec/support/fake_api', __dir__) | ||
end | ||
|
||
def start_fake_api | ||
_stdout, stderr, status = Open3.capture3("docker-compose -f #{fake_api_dir}/docker-compose.yml up -d") | ||
fail "Unable to start Docker fake API\n#{stderr}" unless status.success? | ||
end | ||
|
||
def stop_fake_api | ||
_stdout, stderr, status = Open3.capture3("docker-compose -f #{fake_api_dir}/docker-compose.yml down") | ||
fail "Unable to stop Docker fake API\n#{stderr}" unless status.success? | ||
end | ||
|
||
def with_fake_api | ||
start_fake_api | ||
yield | ||
stop_fake_api | ||
end | ||
|
||
with_fake_api do | ||
bm_gems | ||
bm_path('Search results page', '/en/search?q=') | ||
bm_path('Record page', '/en/record/123/abc.html') | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
rewrite ^/api/v2/record/ /record.json last; | ||
rewrite ^/api/v2/search.json /search.json last; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: "3" | ||
services: | ||
nginx: | ||
image: nginx | ||
ports: | ||
- "3014:80" | ||
volumes: | ||
- ./data:/usr/share/nginx/html | ||
- ./conf.d:/etc/nginx/conf.d |