DI Container Benchmark

Author:Máté Kocsis (@kocsismate90)
Repository:https://github.com/kocsismate/php-di-container-benchmarks
Generated:2020-01-08 10:41:19

Table of Contents


Introduction

In 2014, a really interesting benchmark about DI Containers for PHP was published on Sitepoint. Unfortunately, the implementation of the tests turned out to be quite controversial, so the benchmark itself wasn't very insightful.

I have been interested in the topic since then - and my curiosity was just growing after I had started to develop my own DI container, Zen - so I wanted to conduct another benchmark that also tries to measure real-life performance, while being as unbiased and reliable as possible. So here is my take! If you have any suggestion in mind about the benchmark or you want to add your container to the list, please create an issue or a pull request.

The examined containers are listed below along with some of their attributes:

Name Version Compiled/Dynamic Autowiring
aura/di 4.0.0 dynamic supported
rdlowrey/auryn v1.4.2 dynamic supported
chubbyphp/chubbyphp-container 1.0.3 dynamic not supported
jshannon63/cobalt v1.2.1 dynamic supported
level-2/dice 4.0.1 dynamic supported
bitexpert/disco v0.10.0 compiled not supported
joomla/di 1.5.1 dynamic supported
laminas/laminas-servicemanager 3.4.0 dynamic not supported
illuminate/container v6.10.0 dynamic supported
opulence/ioc v1.1.11 dynamic supported
php-di/php-di 6.0.11 compiled supported
phpixie/di 3.2.1 dynamic not supported
pimple/pimple v3.2.3 dynamic not supported
symfony/dependency-injection v5.0.2 compiled supported
thecodingmachine/yaco v1.0.0 compiled not supported
yiisoft/yii2 2.0.31 dynamic supported
woohoolabs/zen 2.9.0 compiled supported

I'll try to give a vague definition below for some of the aforementioned notions:

A DI Container is compiled if it can be generated into a new class for production usage from where container entries then can be fetched. It means that your dependency graph is resolved during build time. This technique usually results in a very fast DIC, because there is no need for any Reflection or configuration when consuming the container. Dynamic containers however resolve your dependency graph Just-In-Time thus they are by design slower compared to the compiled ones.

A DI Container supports autowiring if it can be configured to automatically inspect and resolve at least some non-trivial subgraphs of the full dependency graph - no matter if the resolution takes place build time or run time. Otherwise all dependencies have to be resolved manually which is probably done as configuration. In this case, a DI Container does not support autowiring.

Essentially, dynamic containers usually need less attention during development than compiled ones, while containers which support autowiring usually need much less configuration than the ones without autowiring capabilities.


Method

Each container is given 6 tasks (Test Suites) where they have to create or fetch object graphs of different sizes (10 or 100 objects). For this purpose, containers are configured either to always instantiate objects (this is usually called as Prototype scope) or to instantiate objects only at the first retrieval and return the same instance on the subsequent calls (which is usually referred to as Singleton scope or shared services).

There are 3 main types of Test Suites: "Cold" ones (Test Suite 1-2) measure performance including autoloading and startup time of containers as well as autoloading time of the retrieved objects. "Semi-Warm" ones (Test Suite 3-4) measure performance excluding container autoloading time, but including startup time and autoloading time of the retrieved objects, while "Warm" ones (Test Suite 5-6) exclude autoloading and startup time equally. Time of compilation is always excluded from the results due to OPcache.

Each Test Suite contains three Test Cases which define the number of iterations the main task has to be repeated in order to simulate real world usage patterns. This number ranges from 10 to 100 000. Furthermore, all Test Cases are performed 30 times (this is referred to as "runs") in order to improve the accuracy of measurements. The median of these results are displayed in the final results.


Setup

The benchmark is run on AWS EC2, using a C5.large instance. The operating system on the host is Ubuntu 18.04. PHP 7.4 is running in a Docker container with OPcache enabled and autoloader optimized (using authoritative mode). During the measurements, a PHP-FPM script served by nginx is executed each time. This is needed because a production environment is simulated much better this way than in the CLI.

The examined DI Containers are configured for production usage as if it was probably done in case of a big project. That's why I took advantage of autowiring capabilities when possible.


Results

Test Suite 1: "Cold" Retrieval of a small object graph (10 objects)

In this Test Suite, containers have to fetch an object graph of 10 objects (defined as Singletons) 10, 100 and 1000 times. Autoloading and startup time of the containers are included in the measurements as well as autoloading time of the retrieved objects. That's why this Test Suite simulates production usage very well.

10 iterations, autoload + startup time included
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Zen 0.041 100% 0.353 100%
2 Symfony 0.046 112% 0.421 119%
3 Yaco 0.066 161% 0.395 112%
4 Chubbyphp 0.069 168% 0.395 112%
5 PHPixie DI 0.081 198% 0.397 112%
6 PHP-DI 0.085 207% 0.356 101%
7 Joomla 0.086 210% 0.432 122%
8 Pimple 0.086 210% 0.402 114%
9 Dice 0.087 212% 0.384 109%
10 Laminas ServiceManager 0.092 224% 0.464 132%
11 Cobalt 0.105 256% 0.442 125%
12 Laravel 0.116 283% 0.435 123%
13 Opulence IoC 0.118 288% 0.443 126%
14 Yii2 Container 0.128 312% 0.488 138%
15 Auryn 0.171 417% 0.384 109%
16 Aura 0.236 576% 0.477 135%
17 Disco 1.573 3837% 1.208 342%

100 iterations, autoload + startup time included
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Zen 0.045 100% 0.353 100%
2 Symfony 0.051 113% 0.421 119%
3 Yaco 0.071 158% 0.395 112%
4 Chubbyphp 0.073 162% 0.395 112%
5 PHP-DI 0.089 198% 0.356 101%
6 Dice 0.094 209% 0.384 109%
7 Pimple 0.096 213% 0.402 114%
8 Joomla 0.097 216% 0.432 122%
9 Laminas ServiceManager 0.099 220% 0.464 132%
10 PHPixie DI 0.104 231% 0.397 112%
11 Cobalt 0.113 251% 0.442 125%
12 Yii2 Container 0.132 293% 0.488 138%
13 Opulence IoC 0.134 298% 0.443 126%
14 Laravel 0.135 300% 0.435 123%
15 Auryn 0.208 462% 0.384 109%
16 Aura 0.241 536% 0.477 135%
17 Disco 0.311 691% 0.458 130%

1000 iterations, autoload + startup time included
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Zen 0.088 100% 0.353 100%
2 Symfony 0.094 107% 0.421 119%
3 Chubbyphp 0.114 130% 0.395 112%
4 Yaco 0.12 136% 0.395 112%
5 PHP-DI 0.14 159% 0.356 101%
6 Dice 0.144 164% 0.384 109%
7 Laminas ServiceManager 0.145 165% 0.464 132%
8 Yii2 Container 0.185 210% 0.488 138%
9 Cobalt 0.19 216% 0.442 125%
10 Pimple 0.196 223% 0.402 114%
11 Joomla 0.212 241% 0.432 122%
12 Aura 0.292 332% 0.477 135%
13 Opulence IoC 0.304 345% 0.443 126%
14 PHPixie DI 0.321 365% 0.397 112%
15 Laravel 0.33 375% 0.435 123%
16 Disco 0.492 559% 0.458 130%
17 Auryn 0.559 635% 0.384 109%

Test Suite 2: "Cold" Retrieval of a big object graph (100 objects)

In this Test Suite, containers have to fetch an object graph of 100 objects (defined as Singletons) 10, 100 and 1000 times. Autoloading and startup time of the containers are included in the measurements as well as autoloading time of the retrieved objects. That's why this Test Suite simulates production usage very well.

10 iterations, autoload + startup time included
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Symfony 0.136 100% 0.441 100%
2 Zen 0.252 185% 0.361 82%
3 Yaco 0.291 214% 0.412 93%
4 Chubbyphp 0.302 222% 0.413 93%
5 PHPixie DI 0.312 229% 0.405 92%
6 Joomla 0.324 238% 0.449 102%
7 PHP-DI 0.339 249% 0.448 101%
8 Laminas ServiceManager 0.346 254% 0.481 109%
9 Pimple 0.362 266% 0.427 97%
10 Opulence IoC 0.522 384% 0.553 125%
11 Cobalt 0.538 396% 0.664 151%
12 Yii2 Container 0.547 402% 0.597 135%
13 Laravel 0.561 413% 0.516 117%
14 Dice 0.563 414% 0.707 160%
15 Disco 0.566 416% 0.563 128%
16 Auryn 0.827 608% 0.61 138%
17 Aura 0.938 690% 0.737 167%

100 iterations, autoload + startup time included
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Symfony 0.142 100% 0.441 100%
2 Zen 0.254 179% 0.361 82%
3 Yaco 0.295 208% 0.412 93%
4 Chubbyphp 0.307 216% 0.413 93%
5 PHPixie DI 0.333 235% 0.405 92%
6 Joomla 0.335 236% 0.449 102%
7 PHP-DI 0.344 242% 0.448 101%
8 Laminas ServiceManager 0.352 248% 0.481 109%
9 Pimple 0.37 261% 0.427 97%
10 Opulence IoC 0.539 380% 0.553 125%
11 Cobalt 0.549 387% 0.664 151%
12 Yii2 Container 0.555 391% 0.597 135%
13 Dice 0.567 399% 0.707 160%
14 Laravel 0.58 408% 0.516 117%
15 Disco 0.59 415% 0.563 128%
16 Auryn 0.863 608% 0.61 138%
17 Aura 0.942 663% 0.737 167%

1000 iterations, autoload + startup time included
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Symfony 0.184 100% 0.441 100%
2 Zen 0.296 161% 0.361 82%
3 Yaco 0.344 187% 0.412 93%
4 Chubbyphp 0.348 189% 0.413 93%
5 PHP-DI 0.394 214% 0.448 101%
6 Laminas ServiceManager 0.399 217% 0.481 109%
7 Joomla 0.452 246% 0.449 102%
8 Pimple 0.475 258% 0.427 97%
9 PHPixie DI 0.553 301% 0.405 92%
10 Yii2 Container 0.61 332% 0.597 135%
11 Dice 0.618 336% 0.707 160%
12 Cobalt 0.63 342% 0.664 151%
13 Opulence IoC 0.705 383% 0.553 125%
14 Disco 0.773 420% 0.563 128%
15 Laravel 0.775 421% 0.516 117%
16 Aura 0.999 543% 0.737 167%
17 Auryn 1.218 662% 0.61 138%

Test Suite 3: "Semi-Warm" Instantiation of a small object graph (10 objects)

In this Test Suite, containers have to create an object graph of 10 objects (defined as Prototypes) 10, 100 and 1000 times. Container autoloading time is excluded while startup time of the container and autoloading time of the retrieved objects are included in the measurements.

10 iterations, startup time included
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Symfony 0.028 100% 0.421 100%
2 Zen 0.035 125% 0.353 84%
3 PHPixie DI 0.073 261% 0.438 104%
4 Cobalt 0.077 275% 0.45 107%
5 Joomla 0.079 282% 0.51 121%
6 Disco 0.084 300% 0.969 230%
7 Laminas ServiceManager 0.088 314% 0.507 120%
8 Dice 0.103 368% 0.374 89%
9 Pimple 0.123 439% 0.47 112%
10 Yii2 Container 0.151 539% 0.521 124%
11 Opulence IoC 0.158 564% 0.386 92%
12 Laravel 0.258 921% 0.439 104%
13 Aura 0.277 989% 0.443 105%
14 Auryn 0.332 1186% 0.37 88%
15 PHP-DI N/A N/A N/A N/A
16 Yaco N/A N/A N/A N/A
17 Chubbyphp N/A N/A N/A N/A

100 iterations, startup time included
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Symfony 0.081 100% 0.421 100%
2 Zen 0.088 109% 0.353 84%
3 Disco 0.194 240% 0.46 109%
4 Cobalt 0.248 306% 0.45 107%
5 PHPixie DI 0.275 340% 0.438 104%
6 Joomla 0.284 351% 0.51 121%
7 Laminas ServiceManager 0.355 438% 0.507 120%
8 Dice 0.412 509% 0.374 89%
9 Pimple 0.562 694% 0.47 112%
10 Yii2 Container 0.682 842% 0.521 124%
11 Opulence IoC 0.887 1095% 0.386 92%
12 Aura 1.561 1927% 0.443 105%
13 Laravel 1.949 2406% 0.439 104%
14 Auryn 2.515 3105% 0.37 88%
15 PHP-DI N/A N/A N/A N/A
16 Yaco N/A N/A N/A N/A
17 Chubbyphp N/A N/A N/A N/A

1000 iterations, startup time included
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Symfony 0.612 100% 0.421 100%
2 Zen 0.63 103% 0.353 84%
3 Disco 1.425 233% 0.46 109%
4 Cobalt 1.975 323% 0.45 107%
5 PHPixie DI 2.303 376% 0.438 104%
6 Joomla 2.334 381% 0.51 121%
7 Laminas ServiceManager 3.035 496% 0.507 120%
8 Dice 3.524 576% 0.374 89%
9 Pimple 4.978 813% 0.47 112%
10 Yii2 Container 6.01 982% 0.521 124%
11 Opulence IoC 8.224 1344% 0.386 92%
12 Aura 14.401 2353% 0.443 105%
13 Laravel 18.881 3085% 0.439 104%
14 Auryn 24.156 3947% 0.37 88%
15 PHP-DI N/A N/A N/A N/A
16 Yaco N/A N/A N/A N/A
17 Chubbyphp N/A N/A N/A N/A

Test Suite 4: "Semi-Warm" Instantiation of a big object graph (100 objects)

In this Test Suite, containers have to create an object graph of 100 objects (defined as Prototypes) 10, 100 and 1000 times. Container autoloading time is excluded while startup time of the container and autoloading time of the retrieved objects are included in the measurements.

10 iterations, startup time included
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Symfony 0.159 100% 0.437 100%
2 Zen 0.282 177% 0.361 83%
3 Disco 0.437 275% 0.531 122%
4 PHPixie DI 0.486 306% 0.447 102%
5 Joomla 0.515 324% 0.518 119%
6 Laminas ServiceManager 0.573 360% 0.521 119%
7 Cobalt 0.665 418% 0.703 161%
8 Pimple 0.792 498% 0.47 108%
9 Dice 0.812 511% 0.612 140%
10 Yii2 Container 1.052 662% 0.589 135%
11 Opulence IoC 1.234 776% 0.55 126%
12 Aura 2.171 1365% 0.703 161%
13 Laravel 2.22 1396% 0.527 121%
14 Auryn 3.055 1921% 0.543 124%
15 PHP-DI N/A N/A N/A N/A
16 Yaco N/A N/A N/A N/A
17 Chubbyphp N/A N/A N/A N/A

100 iterations, startup time included
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Symfony 0.606 100% 0.437 100%
2 Zen 0.732 121% 0.361 83%
3 Disco 1.606 265% 0.531 122%
4 Cobalt 2.373 392% 0.703 161%
5 PHPixie DI 2.491 411% 0.447 102%
6 Joomla 2.732 451% 0.518 119%
7 Laminas ServiceManager 3.186 526% 0.521 119%
8 Dice 4.034 666% 0.612 140%
9 Pimple 5.285 872% 0.47 108%
10 Yii2 Container 6.426 1060% 0.589 135%
11 Opulence IoC 8.945 1476% 0.55 126%
12 Aura 15.273 2520% 0.703 161%
13 Laravel 18.985 3133% 0.527 121%
14 Auryn 25.759 4251% 0.543 124%
15 PHP-DI N/A N/A N/A N/A
16 Yaco N/A N/A N/A N/A
17 Chubbyphp N/A N/A N/A N/A

1000 iterations, startup time included
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Symfony 5.07 100% 0.437 100%
2 Zen 5.239 103% 0.361 83%
3 Disco 13.339 263% 0.531 122%
4 Cobalt 19.311 381% 0.703 161%
5 PHPixie DI 22.433 442% 0.447 102%
6 Joomla 24.76 488% 0.518 119%
7 Laminas ServiceManager 29.174 575% 0.521 119%
8 Dice 36.035 711% 0.612 140%
9 Pimple 50.025 987% 0.47 108%
10 Yii2 Container 60.066 1185% 0.589 135%
11 Opulence IoC 85.924 1695% 0.55 126%
12 Aura 146.202 2884% 0.703 161%
13 Laravel 185.993 3669% 0.527 121%
14 Auryn 252.179 4974% 0.543 124%
15 PHP-DI N/A N/A N/A N/A
16 Yaco N/A N/A N/A N/A
17 Chubbyphp N/A N/A N/A N/A

Test Suite 5: "Warm" Fetching of the same small object graph (10 objects)

In this Test Suite, containers have to fetch an object graph of 10 objects (defined as Singletons) 1000, 10 000 and 100 000 times. Neither autoloading time, nor startup time are included in the measurements.

1000 iterations, bootstrap time excluded
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Chubbyphp 0.046 100% 0.395 100%
2 Symfony 0.049 107% 0.421 107%
3 Zen 0.051 111% 0.353 89%
4 Laminas ServiceManager 0.054 117% 0.464 118%
5 Yaco 0.055 120% 0.395 100%
6 PHP-DI 0.057 124% 0.356 90%
7 Aura 0.058 126% 0.477 121%
8 Yii2 Container 0.06 130% 0.488 124%
9 Dice 0.06 130% 0.384 97%
10 Cobalt 0.086 187% 0.442 112%
11 Pimple 0.112 243% 0.402 102%
12 Joomla 0.127 276% 0.432 109%
13 Opulence IoC 0.189 411% 0.443 112%
14 Disco 0.204 443% 0.458 116%
15 Laravel 0.22 478% 0.435 110%
16 PHPixie DI 0.245 533% 0.397 101%
17 Auryn 0.402 874% 0.384 97%

10 000 iterations, bootstrap time excluded
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Chubbyphp 0.458 100% 0.395 100%
2 Symfony 0.482 105% 0.421 107%
3 Zen 0.503 110% 0.353 89%
4 Laminas ServiceManager 0.531 116% 0.464 118%
5 Yaco 0.54 118% 0.395 100%
6 PHP-DI 0.557 122% 0.356 90%
7 Aura 0.581 127% 0.477 121%
8 Yii2 Container 0.593 129% 0.488 124%
9 Dice 0.594 130% 0.384 97%
10 Cobalt 0.856 187% 0.442 112%
11 Pimple 1.118 244% 0.402 102%
12 Joomla 1.264 276% 0.432 109%
13 Opulence IoC 1.888 412% 0.443 112%
14 Disco 2.045 447% 0.458 116%
15 Laravel 2.192 479% 0.435 110%
16 PHPixie DI 2.448 534% 0.397 101%
17 Auryn 3.916 855% 0.384 97%

100 000 iterations, bootstrap time excluded
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Chubbyphp 4.592 100% 0.395 100%
2 Symfony 4.836 105% 0.421 107%
3 Zen 5.053 110% 0.353 89%
4 Laminas ServiceManager 5.366 117% 0.464 118%
5 Yaco 5.422 118% 0.395 100%
6 PHP-DI 5.538 121% 0.356 90%
7 Aura 5.783 126% 0.477 121%
8 Yii2 Container 5.946 129% 0.488 124%
9 Dice 5.957 130% 0.384 97%
10 Cobalt 8.494 185% 0.442 112%
11 Pimple 11.066 241% 0.402 102%
12 Joomla 12.648 275% 0.432 109%
13 Opulence IoC 18.844 410% 0.443 112%
14 Disco 20.33 443% 0.458 116%
15 Laravel 21.938 478% 0.435 110%
16 PHPixie DI 24.351 530% 0.397 101%
17 Auryn 39.658 864% 0.384 97%

Test Suite 6: "Warm" Fetching of the same big object graph (100 objects)

In this Test Suite, containers have to fetch an object graph of 100 objects (defined as Singletons) 1000, 10 000 and 100 000 times. Neither autoloading time, nor startup time are included in the measurements.

1000 iterations, bootstrap time excluded
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Chubbyphp 0.046 100% 0.413 100%
2 Zen 0.048 104% 0.361 88%
3 Symfony 0.049 107% 0.441 107%
4 PHP-DI 0.056 122% 0.448 109%
5 Yaco 0.056 122% 0.412 100%
6 Laminas ServiceManager 0.056 122% 0.481 117%
7 Dice 0.058 126% 0.707 171%
8 Aura 0.058 126% 0.737 179%
9 Yii2 Container 0.06 130% 0.597 145%
10 Cobalt 0.089 193% 0.664 161%
11 Pimple 0.112 243% 0.427 104%
12 Joomla 0.128 278% 0.449 109%
13 Opulence IoC 0.189 411% 0.553 134%
14 Disco 0.206 448% 0.563 136%
15 Laravel 0.22 478% 0.516 125%
16 PHPixie DI 0.246 535% 0.405 98%
17 Auryn 0.391 850% 0.61 148%

10 000 iterations, bootstrap time excluded
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Chubbyphp 0.457 100% 0.413 100%
2 Zen 0.472 103% 0.361 88%
3 Symfony 0.482 105% 0.441 107%
4 PHP-DI 0.554 121% 0.448 109%
5 Yaco 0.557 122% 0.412 100%
6 Laminas ServiceManager 0.558 122% 0.481 117%
7 Dice 0.573 125% 0.707 171%
8 Aura 0.578 126% 0.737 179%
9 Yii2 Container 0.59 129% 0.597 145%
10 Cobalt 0.881 193% 0.664 161%
11 Pimple 1.112 243% 0.427 104%
12 Joomla 1.267 277% 0.449 109%
13 Opulence IoC 1.9 416% 0.553 134%
14 Disco 2.058 450% 0.563 136%
15 Laravel 2.207 483% 0.516 125%
16 PHPixie DI 2.454 537% 0.405 98%
17 Auryn 3.927 859% 0.61 148%

100 000 iterations, bootstrap time excluded
Rank Container Time (ms) Time (%) Peak Memory (MB) Peak Memory (%)
1 Chubbyphp 4.59 100% 0.413 100%
2 Zen 4.732 103% 0.361 88%
3 Symfony 4.85 106% 0.441 107%
4 PHP-DI 5.54 121% 0.448 109%
5 Yaco 5.592 122% 0.412 100%
6 Laminas ServiceManager 5.592 122% 0.481 117%
7 Dice 5.751 125% 0.707 171%
8 Aura 5.814 127% 0.737 179%
9 Yii2 Container 5.934 129% 0.597 145%
10 Cobalt 8.8 192% 0.664 161%
11 Pimple 11.06 241% 0.427 104%
12 Joomla 12.649 276% 0.449 109%
13 Opulence IoC 18.849 411% 0.553 134%
14 Disco 20.491 446% 0.563 136%
15 Laravel 21.931 478% 0.516 125%
16 PHPixie DI 24.532 534% 0.405 98%
17 Auryn 39.111 852% 0.61 148%


Conclusion

Keep in mind that in a well-architected application you won't call your DI Container hundreds or even thousands of times because ideally there should be as few composition roots as possible (but there is a good chance of needing the container in other places of the application layer - e.g. in your middleware or bootstrap files). That's why most results are exaggerated - you probably won't see milliseconds of difference between the fastest and the slowest DIC in the real life.

To sum up, when choosing a container it only depends on your needs which one suits your project best: if you have a performance-critical application then you probably want to choose a compiled container. If maximum performance is not required, but you develop a big and complex system then I would recommend a dynamic container with autowiring capabilities. Otherwise you can go with simpler containers.