tgoop.com/emacsway_log/1505
Create:
Last Update:
Last Update:
Как я делаю fitness-functions для микросервисов. Мой способ ориентирован на системы среднего размера.
Who Writes Fitness Functions? <...> In general, architects write fitness functions as they determine the objective measures for important architecture characteristics.
-- Building Evolutionary Architectures, by Neal Ford, Patrick Kua, and Rebecca Parsons
Самым существенным оказался, вероятно, вопрос о том, должны ли performance fitness functions тестировать сервис в изоляции или систему целиком?
Однозначного ответа в литературе отыскать не удалось. Даже в оригинальной книге "Building Evolutionary Architectures" ограничились известной фразой "It depends!"
Sam Newman советует оба варианта:
As with functional tests, you may want a mix. You may decide that you want performance tests that isolate individual services, but start with tests that check core journeys in your system. You may be able to take end-to-end journey tests and simply run these at volume.
-- "Building Microservices. Designing Fine-Grained Systems" 2nd edition by Sam Newman
Некоторые аргументы в пользу изолированного тестирования:
- "Load Testing And Microservices Architecture" by Gatling Author
- "Isolate Performance Testing for each Microservice: Part 7" By Brice Dardel
- "Performance Testing of Microservices" by Niranjan Limbachiya
Я склоняюсь к тестированию на обоих уровнях. Поскольку целью fitness functions является улучшение ("селекционирование") архитектурных качеств системы, то команде разработки более удобными могут оказаться изолированные тесты.
Для описания требований я использую Behave. Для любителей Pytest может подойти Pytest-BDD.
Поскольку за прообраз fitness-functions был взят стандарт породы, то это значит, что требование может быть желаемым (целевым) или в пределах допустимого отклонения (допустимого диапазона изменчивости). Поэтому, помечаю их соответственно тэгами
@fitness-function.performance.target и
@fitness-function.performance.acceptable.
Таким образом, запуск тестов можно осуществить или для допустимых, или для целевых требований. Получается что-то типа:
@fitness-function.performance.acceptable
Scenario: Some object endpoint name
Given SUT with 10000000 objects
When 100 processes created 10000 objects each
Then average RPS is greater than 1000
And error rate is less than 5%
@fitness-function.performance.target
Scenario: Some object endpoint name
Given SUT with 30000000 objects
When 100 processes created 10000 objects each
Then average RPS is greater than 1000
And error rate is less than 5%
Продолжение.
BY emacsway-log: Software Design, Clean Architecture, DDD, Microservice Architecture, Distributed Systems, XP, Agile, etc.
Share with your friend now:
tgoop.com/emacsway_log/1505