Resource Intensive PHP Tasks part 2

The requirements

Like the good developers we are we will kick of things by defining some requirements to help us in the design process.

But first some definitions.

Controller: PHP Script that directs receives and responds to requests

Worker: PHP Script that carries out resource/time intensive task

Model: PHP Script that provides the data framework. This can be anything from file system to the DB connection.

With that out of the way here are our requirements:

  1. System must respond within 5 seconds
  2. Controllers must not under any circumstances run for more than 30 seconds CPU time.
  3. Controllers should be able to report progress
  4. Controllers must be able to run on shared hosting service
  5. Workers must be able to operate independently.
  6. Workers should never have to interact with the file system.
  7. Workers should be easily exportable
  8. Workers should be RESTful
  9. Workers should have one verb to accept work. Common convention is to call this verb fire or index.
  10. Model must never return system resource handles
  11. Model must provide expected value types even on failure


A fair lot of the requirements are self explanatory. If you would like me to expound some more on any of this please comment as much below. Otherwise it will become obvious why we have the requirements in a bit.


Next article we will look at a sample work flow and the request life cycle. We will also get to see the relationship between the objects in our system.

by Jacob Chencha