- Issue created by @Chi
- 🇷🇺Russia Chi
implies opening DB connection
Opening DB connection is rather expensive operation, especially in PostgreSQL. Even if the cache is managed through in memory backend (Redis/Memcache) Drupal will open DB connection as bootstrap container depends on Database service.
- 🇬🇧United Kingdom catch
The Symfony container is written to a PHP file, unless something has changed.
We can't require write permissions to a PHP file in production.
Modules being installed/uninstalled and affecting the container means we also can't require the container is compiled at build time.
These are the two reasons we moved to keeping the container in the database in the first place and they both continue to be valid as far as I know. The original decision to use Symfony's container ignored both of these constraints and we've been dealing with that since.
- 🇷🇺Russia Chi
We can't require write permissions to a PHP file in production.
For Twig files it was resolved in #2544932: Twig should not rely on loading php from shared file system → . Can it be done same way for containers?
Anyway DB based container cache may still exist and used as fallback for sites that need container rebuild in non CLI SAPI. The point is to use more efficient solution by default.