summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAleksei Lipniagov <alipniagov@gitlab.com>2019-06-25 15:11:06 +0300
committerAleksei Lipniagov <alipniagov@gitlab.com>2019-06-28 20:12:50 +0300
commitf44719f39cb9ee88c63759caa582d484cd6d4e9a (patch)
tree7afc8b86283c3e1537f728c66ef3b0130e2b677d /scripts
parent1cd8fb49f9b9150faf50767edbdfb564fde8576b (diff)
downloadgitlab-ce-f44719f39cb9ee88c63759caa582d484cd6d4e9a.tar.gz
Get memory data after booting app in production62722-boot-app-in-ci-and-check-memory-ce
Preload the app in `production` env, hit it with a single request, and gather total gem memory consumption data using `derailed exec perf:mem` from `derailed_benchmarks`. Present the result as MR metrics.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generate-memory-metrics-on-boot11
-rw-r--r--scripts/prepare_build.sh10
2 files changed, 17 insertions, 4 deletions
diff --git a/scripts/generate-memory-metrics-on-boot b/scripts/generate-memory-metrics-on-boot
new file mode 100755
index 00000000000..5197a8fcdcd
--- /dev/null
+++ b/scripts/generate-memory-metrics-on-boot
@@ -0,0 +1,11 @@
+#!/usr/bin/env ruby
+
+abort "usage: #{__FILE__} <memory_bundle_mem_file_name>" unless ARGV.length == 1
+memory_bundle_mem_file_name = ARGV.first
+
+full_report = File.open(memory_bundle_mem_file_name).read
+
+stats = /TOP: (?<total_mibs_str>.*) MiB/.match(full_report)
+abort 'failed to process the benchmark output' unless stats
+
+puts "total_memory_used_by_dependencies_on_boot_prod_env_mb #{stats[:total_mibs_str].to_f.round(1)}"
diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh
index 9b0d5d4f719..0950ec272a5 100644
--- a/scripts/prepare_build.sh
+++ b/scripts/prepare_build.sh
@@ -35,9 +35,11 @@ sed -i 's/username: root/username: gitlab/g' config/database.yml
if [ "$GITLAB_DATABASE" = 'postgresql' ]; then
sed -i 's/localhost/postgres/g' config/database.yml
+ sed -i 's/username: git/username: postgres/g' config/database.yml
if [ -f config/database_geo.yml ]; then
sed -i 's/localhost/postgres/g' config/database_geo.yml
+ sed -i 's/username: git/username: postgres/g' config/database_geo.yml
fi
else # Assume it's mysql
sed -i 's/localhost/mysql/g' config/database.yml
@@ -48,16 +50,16 @@ else # Assume it's mysql
fi
cp config/resque.yml.example config/resque.yml
-sed -i 's/localhost/redis/g' config/resque.yml
+sed -i 's|url:.*$|url: redis://redis:6379|g' config/resque.yml
cp config/redis.cache.yml.example config/redis.cache.yml
-sed -i 's/localhost/redis/g' config/redis.cache.yml
+sed -i 's|url:.*$|url: redis://redis:6379/10|g' config/redis.cache.yml
cp config/redis.queues.yml.example config/redis.queues.yml
-sed -i 's/localhost/redis/g' config/redis.queues.yml
+sed -i 's|url:.*$|url: redis://redis:6379/11|g' config/redis.queues.yml
cp config/redis.shared_state.yml.example config/redis.shared_state.yml
-sed -i 's/localhost/redis/g' config/redis.shared_state.yml
+sed -i 's|url:.*$|url: redis://redis:6379/12|g' config/redis.shared_state.yml
if [ "$SETUP_DB" != "false" ]; then
setup_db