-
Notifications
You must be signed in to change notification settings - Fork 84
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
Task4 #133
Open
Yorickov
wants to merge
6
commits into
hardcode-dev:master
Choose a base branch
from
Yorickov:task4
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Task4 #133
Changes from 4 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
lts/dubnium | ||
lts/erbium |
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
web: bin/rails s -p 3000 | ||
webpacker: ./bin/webpack-dev-server | ||
job: bin/rake jobs:work | ||
prometheus_exporter: bundle exec prometheus_exporter |
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,3 @@ | ||
web: bin/rails s -p 3000 -e local_production | ||
job: bin/rake jobs:work | ||
prometheus_exporter: bundle exec prometheus_exporter |
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
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,81 @@ | ||
# Case-study оптимизации | ||
|
||
## Подготовка | ||
|
||
- Удалось накатить 2.6.3 на M1 с помощью RUBY_CFLAGS="-w", поднял `dev.to` локально (node 12) | ||
- `Skylight` запустить не удалось (не добавляется свое окружение), дальше - без него | ||
- Настроил `NewRelic` для 'development', заюзал siege | ||
- Настроил `Scout` для 'development', понравился больше за счет дружественного UI. | ||
- `Datadog` победить не смог, опять проблемы с arm64 - не стал терять время ибо имеющихся средств достаточно | ||
- Настроил `Prometheus` + `Grafana` для мониторинга локального `dev.to` | ||
- Настроил `local_production` для проекта и подкючил `NewRelic`, `Scout`, `Prometheus` + `Grafana` | ||
- Настроил `rack-mini-profiler` и `rails-panel` для `local_production` | ||
|
||
## Оптимизация | ||
|
||
Использовались ab, RMP и newrelic | ||
_Initial state_ | ||
|
||
1. benchmark с помощью `ab` (100 requests) | ||
`development`: | ||
Time taken for tests: 33.005 seconds | ||
Requests per second: 3.03 [#/sec](mean) | ||
|
||
`local_production`: | ||
Concurrency Level: 1 | ||
Time taken for tests: 18.913 seconds | ||
Complete requests: 100 | ||
Failed requests: 14 | ||
(Connect: 0, Receive: 0, Length: 14, Exceptions: 0) | ||
Total transferred: 14026571 bytes | ||
HTML transferred: 13922285 bytes | ||
Requests per second: 5.29 [#/sec](mean) | ||
Time per request: 189.132 [ms](mean) | ||
Time per request: 189.132 [ms] (mean, across all concurrent requests) | ||
Transfer rate: 724.25 [Kbytes/sec] received | ||
|
||
`Базовая метрика`: | ||
Time taken for tests: 18.913 seconds | ||
|
||
2. RMP | ||
"stories#index" - 218.9 ms | ||
проблема - много вызовов паршла `_single_story.html.erb` | ||
Rendering: articles/\_single_story.html.erb (по ~1,5ms отъедает) | ||
|
||
3. newrelic | ||
Controller/stories/index: ~240 ms | ||
|
||
_Actions_ | ||
Корень проблемы: root "stories#index" -> articles/index -> stories/main_stories_feed -> articles/single_story | ||
Кэшируется с юзером, но не без. Добавляем кэширование single_story | ||
|
||
_Filnal state_ | ||
|
||
1. ab | ||
|
||
Concurrency Level: 1 | ||
Time taken for tests: 11.005 seconds | ||
Complete requests: 100 | ||
Failed requests: 20 | ||
(Connect: 0, Receive: 0, Length: 20, Exceptions: 0) | ||
Total transferred: 14031359 bytes | ||
HTML transferred: 13927079 bytes | ||
Requests per second: 9.09 [#/sec](mean) | ||
Time per request: 110.053 [ms](mean) | ||
Time per request: 110.053 [ms] (mean, across all concurrent requests) | ||
Transfer rate: 1245.09 [Kbytes/sec] received | ||
|
||
2. RMP | ||
"stories#index" - 131.2 ms | ||
|
||
3. newrelic | ||
Controller/stories/index: ~120 ms | ||
|
||
`Базовая метрика`: | ||
Time taken for tests: 11.005 seconds (- 9 sec) | ||
|
||
Данные new relic - в png: | ||
замерялись на `siege -c 10 -t180s http://localhost:3000` + 1 мин. фона | ||
|
||
Не сказать что большой прогресс, но ОК. | ||
В целом хорошо зарекомендовали newlelic, RMP и ab. Сборка кривоватая - не все работает, особенно на M1, но инструменты изучить позволяет | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍