-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add php benchmarks * fixes * fixes * fixes * fixes * fixes
- Loading branch information
Showing
10 changed files
with
234 additions
and
40 deletions.
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
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,82 @@ | ||
<?php | ||
|
||
namespace Test\Ecotone\Benchmark; | ||
|
||
use Ecotone\Lite\EcotoneLite; | ||
use Ecotone\Messaging\Config\ModulePackageList; | ||
use Ecotone\Messaging\Config\ServiceConfiguration; | ||
use PHPUnit\Framework\TestCase; | ||
use Test\Ecotone\Modelling\Fixture\CommandEventFlow\CreateMerchant; | ||
use Test\Ecotone\Modelling\Fixture\CommandEventFlow\Merchant; | ||
use Test\Ecotone\Modelling\Fixture\CommandEventFlow\MerchantSubscriber; | ||
use Test\Ecotone\Modelling\Fixture\CommandEventFlow\User; | ||
use Test\Ecotone\Modelling\Fixture\CommandHandler\Aggregate\InMemoryStandardRepository; | ||
|
||
class EcotoneBenchmark extends TestCase | ||
{ | ||
/** | ||
* @Revs(10) | ||
* @Iterations(5) | ||
* @Warmup(1) | ||
*/ | ||
public function bench_running_ecotone_lite() | ||
{ | ||
$this->execute( | ||
ServiceConfiguration::createWithDefaults() | ||
->withFailFast(false) | ||
->withSkippedModulePackageNames(ModulePackageList::allPackages()), | ||
false | ||
); | ||
} | ||
|
||
/** | ||
* @Revs(10) | ||
* @Iterations(5) | ||
* @Warmup(1) | ||
*/ | ||
public function bench_running_ecotone_lite_with_fail_fast() | ||
{ | ||
$this->execute( | ||
ServiceConfiguration::createWithDefaults() | ||
->withFailFast(true) | ||
->withSkippedModulePackageNames(ModulePackageList::allPackages()), | ||
false | ||
); | ||
} | ||
|
||
/** | ||
* @Revs(10) | ||
* @Iterations(5) | ||
* @Warmup(1) | ||
*/ | ||
public function bench_running_ecotone_lite_with_cache() | ||
{ | ||
$this->execute( | ||
ServiceConfiguration::createWithDefaults() | ||
->withFailFast(false) | ||
->withCacheDirectoryPath(sys_get_temp_dir()) | ||
->withSkippedModulePackageNames(ModulePackageList::allPackages()), | ||
true | ||
); | ||
} | ||
|
||
private function execute(ServiceConfiguration $serviceConfiguration, bool $useCachedVersion): void | ||
{ | ||
$ecotoneApplication = EcotoneLite::bootstrap( | ||
[Merchant::class, User::class, MerchantSubscriber::class, InMemoryStandardRepository::class], | ||
[ | ||
new MerchantSubscriber(), InMemoryStandardRepository::createEmpty() | ||
], | ||
$serviceConfiguration, | ||
useCachedVersion: $useCachedVersion, | ||
allowGatewaysToBeRegisteredInContainer: true | ||
); | ||
|
||
$merchantId = '123'; | ||
$ecotoneApplication->getCommandBus()->send(new CreateMerchant($merchantId)); | ||
|
||
$this->assertTrue( | ||
$ecotoneApplication->getQueryBus()->sendWithRouting('user.get', metadata: ['aggregate.id' => $merchantId]) | ||
); | ||
} | ||
} |
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
67 changes: 67 additions & 0 deletions
67
packages/Laravel/tests/Application/Benchmark/EcotoneBenchmark.php
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,67 @@ | ||
<?php | ||
|
||
namespace Test\Ecotone\Laravel\Application\Benchmark; | ||
|
||
use Ecotone\Messaging\Config\ConfiguredMessagingSystem; | ||
use Illuminate\Foundation\Application; | ||
use Illuminate\Foundation\Http\Kernel; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class | ||
EcotoneBenchmark extends TestCase | ||
{ | ||
/** | ||
* @Revs(10) | ||
* @Iterations(5) | ||
* @Warmup(1) | ||
*/ | ||
public function bench_kernel_boot_on_prod() | ||
{ | ||
putenv("APP_ENV=production"); | ||
$this->createApplication(); | ||
} | ||
|
||
/** | ||
* @Revs(10) | ||
* @Iterations(5) | ||
* @Warmup(1) | ||
*/ | ||
public function bench_kernel_boot_on_dev() | ||
{ | ||
putenv('APP_ENV=development'); | ||
$this->createApplication(); | ||
} | ||
|
||
/** | ||
* @Revs(10) | ||
* @Iterations(5) | ||
* @Warmup(1) | ||
*/ | ||
public function bench_messaging_boot_on_prod() | ||
{ | ||
putenv('APP_ENV=production'); | ||
$app = $this->createApplication(); | ||
$app->make(ConfiguredMessagingSystem::class); | ||
} | ||
|
||
/** | ||
* @Revs(10) | ||
* @Iterations(5) | ||
* @Warmup(1) | ||
*/ | ||
public function bench_messaging_boot_on_dev() | ||
{ | ||
putenv('APP_ENV=development'); | ||
$app = $this->createApplication(); | ||
$app->make(ConfiguredMessagingSystem::class); | ||
} | ||
|
||
public function createApplication(): Application | ||
{ | ||
$app = require __DIR__ . '/../bootstrap/app.php'; | ||
|
||
$app->make(Kernel::class)->bootstrap(); | ||
|
||
return $app; | ||
} | ||
} |
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,55 @@ | ||
<?php | ||
|
||
namespace Benchmark; | ||
|
||
use Ecotone\Messaging\Config\ConfiguredMessagingSystem; | ||
use Ecotone\SymfonyBundle\App\Kernel; | ||
|
||
class EcotoneBenchmark | ||
{ | ||
/** | ||
* @Revs(10) | ||
* @Iterations(5) | ||
* @Warmup(1) | ||
*/ | ||
public function bench_kernel_boot_on_prod() | ||
{ | ||
$kernel = new Kernel('prod', false); | ||
$kernel->boot(); | ||
} | ||
|
||
/** | ||
* @Revs(10) | ||
* @Iterations(5) | ||
* @Warmup(1) | ||
*/ | ||
public function bench_kernel_boot_on_dev() | ||
{ | ||
$kernel = new Kernel('dev', false); | ||
$kernel->boot(); | ||
} | ||
|
||
/** | ||
* @Revs(10) | ||
* @Iterations(5) | ||
* @Warmup(1) | ||
*/ | ||
public function bench_messaging_boot_on_prod() | ||
{ | ||
$kernel = new Kernel('prod', false); | ||
$kernel->boot(); | ||
$kernel->getContainer()->get(ConfiguredMessagingSystem::class); | ||
} | ||
|
||
/** | ||
* @Revs(10) | ||
* @Iterations(5) | ||
* @Warmup(1) | ||
*/ | ||
public function bench_messaging_boot_on_dev() | ||
{ | ||
$kernel = new Kernel('dev', false); | ||
$kernel->boot(); | ||
$kernel->getContainer()->get(ConfiguredMessagingSystem::class); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.