Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

week 4 optimisation (Shlyapnikov) #143

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

usernaimandrey
Copy link

@usernaimandrey usernaimandrey commented Feb 22, 2025

  1. Настроен мониторинг через Prometheus+Grafanaдля мониторинга локальногоdev.to`
  2. Настроен NewRelic для мониторинга локального dev.to
  3. Настроил Skylight
  4. Добавил gem pghero и rack-mini-profiler - для профилирования
  5. В качестве альтернативы попробовал gem [rails_performance](https://github.com/igorkasyanchuk/rails_performance)
    Который позицианируют как: "This is a simple and free alternative to the New Relic APM, Datadog or other similar services."
  6. С помощью ab и rack-mini-profiler - подтверждена гипотиза что заметное время занимает рендеринг partial-ов _single_story.html.erb
  7. Закешировал паршл app/views/articles/tag_index.html.erb который по моему мнению довольно статичен и изменяется редко

Copy link
Collaborator

@spajic spajic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Респект, по максимуму всего сделано 👍

100% 2054 (longest request)
```

## После того как закешировали паршл среднее время ответа уменьшилось в 2,5 раза
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Document Path: /
Document Length: 143451 bytes
Concurrency Level: 5
Time taken for tests: 2.669 seconds
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

как-бдуто >10x по сравнлению с 33.310 seconds

100% 206 (longest request)
```

## на local_production окружении с кешированием и прекомпиляци ассетов срднее время ответа уменьшилось почти в 5 раз
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

require 'prometheus_exporter/middleware'
require 'prometheus_exporter/client'

prometheus_client = PrometheusExporter::Client.new(host: 'localhost')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -0,0 +1,62 @@
RailsPerformance.setup do |config|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ого, я не видел этот гем раньше, респект

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да я вот, чисто случайно нашел)

@@ -1,3 +1,9 @@
require 'prometheus_exporter/instrumentation'
PrometheusExporter::Instrumentation::ActiveRecord.start(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

- '-config.file=/etc/prometheus/prometheus.yml'
ports:
- '9090:9090'
grafana:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants