Read about our upcoming Code of Conduct on this issue

memory.gitlab-ci.yml 2.08 KB
Newer Older
1
.only-code-memory-job-base:
Stan Hu's avatar
Stan Hu committed
2
3
4
5
  extends:
    - .default-retry
    - .default-cache
    - .default-before_script
6
    - .memory:rules
7
8
9

memory-static:
  extends: .only-code-memory-job-base
10
  stage: test
11
  needs: ["setup-test-env pg11"]
Stan Hu's avatar
Stan Hu committed
12
13
  variables:
    SETUP_DB: "false"
14
15
16
17
18
  script:
    # Uses two different reports from the 'derailed_benchmars' gem.

    # Loads each of gems in the Gemfile and checks how much memory they consume when they are required.
    # 'derailed_benchmarks' internally uses 'get_process_mem'
19
20
    - bundle exec derailed bundle:mem > tmp/memory_bundle_mem.txt
    - scripts/generate-gems-size-metrics-static tmp/memory_bundle_mem.txt >> 'tmp/memory_metrics.txt'
21
22
23

    # Outputs detailed information about objects created while gems are loaded.
    # 'derailed_benchmarks' internally uses 'memory_profiler'
24
25
    - bundle exec derailed bundle:objects > tmp/memory_bundle_objects.txt
    - scripts/generate-gems-memory-metrics-static tmp/memory_bundle_objects.txt >> 'tmp/memory_metrics.txt'
26
27
  artifacts:
    paths:
28
      - tmp/memory_*.txt
29
    reports:
30
      metrics: tmp/memory_metrics.txt
31
32
33
34
35
36

# Show memory usage caused by invoking require per gem.
# Unlike `memory-static`, it hits the app with one request to ensure that any last minute require-s have been called.
# The application is booted in `production` environment.
# All tests are run without a webserver (directly using Rack::Mock by default).
memory-on-boot:
Stan Hu's avatar
Stan Hu committed
37
  extends:
38
    - .only-code-memory-job-base
39
    - .use-pg11
40
  stage: test
41
  needs: ["setup-test-env pg11", "compile-assets pull-cache"]
42
43
44
45
46
47
48
49
  variables:
    NODE_ENV: "production"
    RAILS_ENV: "production"
    SETUP_DB: "true"
    SKIP_STORAGE_VALIDATION: "true"
    # we override the max_old_space_size to prevent OOM errors
    NODE_OPTIONS: --max_old_space_size=3584
  script:
50
    - PATH_TO_HIT="/users/sign_in" CUT_OFF=0.3 bundle exec derailed exec perf:mem >> 'tmp/memory_on_boot.txt'
51
52
53
54
55
56
    - scripts/generate-memory-metrics-on-boot tmp/memory_on_boot.txt >> 'tmp/memory_on_boot_metrics.txt'
  artifacts:
    paths:
      - tmp/memory_*.txt
    reports:
      metrics: tmp/memory_on_boot_metrics.txt