Published on 2008-02-20 13:26:15
Implementation
We can build scalability through abstraction, we can handle many requests with apache and PHP and offload much of the data intensive computational work to Oracle. We can achieve this with the use of re used persistent connections and a wrapper abstraction layer to Oracle. For instance our online library allows people to renew their books online. To abstract the computational work involved in renewing a book we can farm it out to oracle.
Example:
This calls the corresponding procedure in oracle called renewBook and oracle takes care of looking up the book applying control logic and updating the relevant records.
This approach separates the control logic of the application from the web tier. You can now scale your web tier and your data and logic tier separately.
Benefits of Abstraction
Each procedure is compiled once and the sql contained within it is optimised and reused so the query execution planner does not have to work each time. Oracle scales nicely, oracle have many products filling the gaps from low end to high end big iron enterprise offerings, eventually your applications logic could be running on a 64 core CPU! Now with persistent connections the connections to oracle can be reused and therefore there is little overhead on each script having to open and close heavy weight connections. You can have multiple front ends on the application, allowing a java swing client to be lightweight and has access to all the logic that is within the procedures. You can scale where your bottle necks are occurring, if the hold up is with the number of connections non worker apache can handle than you can load balance apache and add more nodes.
Natural Path of a Growing PHP Oracle Application
Here is an example of the natural growth pattern of a PHP Oracle Application:
This article should give you the basic overview of abstraction with Oracle, you can download Oracle Express Edition and PHP for free and you can follow the examples later in the series.
About the Author
Gareth Fiford has been a PHP and Oracle developer with leading telecoms companies and gambling companies and now is the owner of www.phporaclehosting.com
Member of the PHP Magazine Network, Copyright (C) 2005-2008 phpmagazine.net All Rights Reserved