Doctrine Entity Manager for Long Running Processes #8612
-
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. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
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. |
Beta Was this translation helpful? Give feedback.
-
Got it! thanks for clarifying. |
Beta Was this translation helpful? Give feedback.
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.