Issue summary update: #2
Beta phase evaluation
| Issue category | Task because it's not a bug, but a potential performance gain, something to be done |
|---|---|
| Issue priority | Normal since it can gain some, but not significant performance gain |
| Disruption | Potentially disruptive(?) for the code that relies on always available DB connection |
Discussed in #2229145: Register symfony session components in the DIC and inject the session service into the request object.
The session manager has a database connection dependency. However on some page requests, it's possible that the only thing that actually happen is on SessionConfiguration::hasSession() which only needs to check a cookie.
This could be a performance hit in the following situation:
1. Database session handler
2. Non-database cache backend
3. Anonymous user gets a page cache miss
4. Everything else that would have triggered a database hit is cached or is hitting some alternative storage
5. This results in a database connection being initialized, even though no actual queries get run.
This is a regression from Drupal 7 where db_query()/db_select() were the main entry points to initializing a db connection.
Proposed resolution
Not sure. The ideal situation for performance would be not initializing the database connection at all until the first real query is run. Then services that inject database + cache and don't need the database if they get a cache hit would also not result in a database connection.
Comments
Comment #1
valthebaldEvaluate the issue during Friday sprints
Comment #2
valthebaldAdded issue summary update, changed priority to Normal
Issue should be postponed according to beta evaluation flowchart
Comment #16
smustgrave commentedThank you for creating this issue to improve Drupal.
We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #17
catchPretty sure this one is still relevant.