-
Notifications
You must be signed in to change notification settings - Fork 46
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
[#7] Boreiko #29
Open
Gankster
wants to merge
1
commit into
hardcode-dev:master
Choose a base branch
from
Gankster:master
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.
+86
−0
Open
[#7] Boreiko #29
Changes from all 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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Case-study | ||
|
||
1. Прогнал все тесты в режиме `--profile` и получил список самых медленных тестов и групп | ||
``` | ||
Top 10 slowest examples (19.31 seconds, 19.6% of total time): | ||
Api::V2::SkusHistories /skus_import_batch PUT adds rows to SkusImportBatch | ||
3.69 seconds ./spec/api/v2/skus_histories_spec.rb:207 | ||
... | ||
|
||
Top 10 slowest example groups: | ||
Api::V2::SkusGroup | ||
0.83148 seconds average (4.99 seconds / 6 examples) ./spec/api/v2/skus_group_spec.rb | ||
... | ||
|
||
Finished in 1 minute 38.63 seconds (files took 9.67 seconds to load) | ||
360 examples, 0 failures, 1 pending | ||
``` | ||
|
||
2. Настроил связку `InfluxDB` и `Chronograf` собрал первые данные | ||
|
||
3. Пробовал запускать в паралельно, но больше половины тестов свалилось, много ошибок связаных с `Eelasticsearch`, решил отложить на потом | ||
|
||
4. Добавил гем `test-prof` | ||
- Поигрался со `stackprof`. Запускал в `https://www.speedscope.app` и `qcachegrind`, не нашол ничего конкретного для оптимизации | ||
- Прогнал тесты в режиме `Rspec-Dissect` запустив `RD_PROF=1 rspec` | ||
``` | ||
Total time: 02:07.425 | ||
|
||
Total `let` time: 00:20.822 | ||
Total `before(:each)` time: 00:54.214 | ||
|
||
Top 5 slowest suites (by `let` time): | ||
|
||
UpdateSkuService (./spec/services/update_sku_service_spec.rb:3) – 00:06.811 of 00:07.615 (44) | ||
... | ||
... | ||
``` | ||
* Запустил `RD_PROF=1 rspec spec/services/update_sku_service_spec.rb:3` | ||
``` | ||
Total time: 00:07.872 | ||
|
||
Total `let` time: 00:06.945 | ||
Total `before(:each)` time: 00:05.030 | ||
``` | ||
* Заменил `let!` на `let_it_be` запустил еще раз | ||
``` | ||
Total time: 00:04.138 | ||
|
||
Total `let` time: 00:03.245 | ||
Total `before(:each)` time: 00:01.325 | ||
``` | ||
- Прогнал тесты с помощью `FactoryProf` | ||
``` | ||
[TEST PROF INFO] Time spent in factories: 00:26.795 (14.02% of total time) | ||
``` | ||
``` | ||
[TEST PROF INFO] Factories usage | ||
|
||
Total: 680 | ||
Total top-level: 507 | ||
Total time: 00:16.351 (out of 01:52.903) | ||
Total uniq factories: 23 | ||
|
||
total top-level total time time per call top-level time name | ||
|
||
296 130 2.7250s 0.0092s 1.2657s parcel_item | ||
208 208 11.5975s 0.0558s 11.5975s parcel_sku | ||
73 71 0.6848s 0.0094s 0.6688s harmonized_code | ||
``` | ||
![img1](factory_flame_report.png) | ||
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. всё спокойно |
||
- Прогнал тесты с помощью `FactoryDoctor` | ||
``` | ||
[TEST PROF INFO] FactoryDoctor report | ||
|
||
Total (potentially) bad examples: 9 | ||
Total wasted time: 00:01.023 | ||
``` | ||
- Прогнал тесты с помощью `TagProf` | ||
![img2](tag_prof_report.png) | ||
|
||
## Заключение | ||
|
||
После ознакомления с `TestProf` и сбора DX метрик я понял что в даном проекти все хорошо. | ||
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. Ну и хорошо! |
||
![img3](graf.png) | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Видимо у вас используется реальный эластик в тестах, и он получился один на несколько процессов и пошли конфликты.
Можно решить