Saturday, August 29, 2009

S.M.A.R.T.

I'm attending the PMP (Project Management Professional) course in the mornings and the NCAP (National Coaching something) in the evenings.

One thing that came up in two very different courses is the concept of S.M.A.R.T. for setting goals.

S - Specific
M - Measurable
A - Achievable
R - Relevant
T - Time bound

Thursday, August 20, 2009

Threading?

So we have to process a huge amount of data and send them to a different machine. It seems that the sending part (the actual HTTP request in the SOAP call) is slow, and it was suggested to speed things up with multiple threads.

Firstly, my knowledge of PHP is limited on threading, and secondly it seems PHP don't have sophisicated threading APIs like Java or dotNET.

So I came up with a solution that makes multiple SOAP calls to the remote server, but not using threads.

In processing the data, the table has a row id. Simply decide how many concurrent processes you want, and pick out the data to process by the modulus. e.g. if you want to have 2 concurrent processes to send out SOAP messages, pick out the data as such
where id%2=0
and
where id%2=1
Two cron jobs are created, one to call each script with the different parameter (of course, we can do this via a bash script so only one cron job is created).

So there, no race-conditions, no hung threads (ok, maybe hung process), and no headaches.