mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Doctrine Entity Manager for Long Running Processes #6658
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @aftabnaveed on GitHub (Mar 25, 2021).
We recently adapted swoole and are using it in production. Since it keeps our Laravel framework in memory thus eliminating the 50 ms boot time. On top of the that instead of keeping most of our Application configurations (read from XML) in cache we are now able to load it into memory during application startup thus tremandously optimising the response time. The accumlated time we are saving per request is now more than 100 ms which is a significant time for a heavy load and traffic website.
However, PHP is meant to be short lived processes and all the libraries and frameworks are built that way. We are able address to some of the framework related issues either by avoiding some of it's singleton pattern services such as Users, Sessions provided by them. We still re-use these services but instead we re-create these ourselves.
This does not seem to be so simple when dealing with Libraries, there are a few issues I would like to mention here which are specific to Doctrine PHP.
Although the performance benefits of using Doctrine in such an environment may not be that big, but due to the aforementioned scenario where you can put the entire framework and cofiguration in memory thus avoiding using cache, it would be great if a conversation like this opened and see the possibility of improvements.
@beberlei commented on GitHub (Mar 26, 2021):
You need one entity manager and thus one commection per request because of the UnitOfWork. Doctrine is made for shared nothing architecture.
Some database drivers support persistent connections, which afaik is just connection pooling.
@aftabnaveed commented on GitHub (Mar 26, 2021):
Got it! thanks for clarifying.