PDO和性能

There is a large php application that uses the PDO api (http://php.net/pdo) to store and retrieve information from one or more databases. Over the software development lifetime of your application, you have found that a significant number of performance problems have been due to PDO API calls taking a long time.

  • How would you determine how much time is being spent in each PDO API call? We are not interested in differentiating the amount DB execution time from the amount of time in each API call.
  • How does your solution impact the maintainability of your application? Specifically, if a new framework is added to the application how would your solution time PDO calls in that framework?
  • In what ways could your solution change the performance characteristics of your application?

How would you determine how much time is being spent in each PDO API call? We are not interested in differentiating the amount DB execution time from the amount of time in each API call.

I would inherit from PDO with my custom class and put watches there

How does your solution impact the maintainability of your application? Specifically, if a new framework is added to the application how would your solution time PDO calls in that framework?

Everything that can work with PDO would work with the extension as well. LSP principle

In what ways could your solution change the performance characteristics of your application?

Nope (excluding the minor overhead for storing profiling results, if you need it)