I'm not familiar with gearman, but I think I'm gonna need it soon.
Post by Eric BlanpiedI think the best way to do it is with a queue. After doing several
websites in which cron jobs were used for various not-so-cron things
(cron job to wake up periodically and check for needed tasks? why not
just spawn the tasks?), I came to the conclusion that a job queue was
a much smarter answer.
Accordingly, I've just woven Gearman (http://gearman.org/) into one of
our cake projects, with a very simple component wrapping the gearman
client. The workers are pure php, with no knowledge of the app or
database, reducing dependencies as well as possible. The client passes
the workers json-encoded parameters, and the workers call a cake
method when done, again with json-encoded return data, and cake makes
any database updates as appropriate. Now we can do all sorts of things
outside of the user's browser session, and in the future could move
these things off to a different server if we wished.
Of course, if your other tasks were very much cake-related, and you
wanted them to use the framework, I see no reason why you couldn't
write your workers within the framework.
There are other queue/messaging systems out there (beanstalk's got a
good following), but in my research I liked what gearman had to offer
best. There's also Persson's cakephp Queue plugin, but I wanted a
lighter system, with no cake dependencies on the worker side.
-e
Post by f***@public.gmane.orgWhat about using javascript. It would only work while the user is on the
site, but it would be able to call a function (also ajax if you want to
trigger a php method) very x seconds.
-flosky
Post by Ryan Schmidtis there anyway to run a process separate from the page load. I
would
love to run a pseudo cronjob on each page load if it could be done without
negatively effecting performance in a serious way. (I was thinking
curl,
and ajax, but they didn't really seem to fit the bill) Any experts
out
there know how to start a cron task outside of the page load, but triggered
by a page load?
cron is a program that schedules things to run at particular times of the
day. "start a cron task ... triggered by a page load" therefore doesn't make
sense.
What kind of task do you want to start? The solution might be different
depending on the task.
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.
To unsubscribe from this group, send email to
group
at http://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.
To unsubscribe from this group, send email to
at
http://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.
To unsubscribe from this group, send email to
at http://groups.google.com/group/cake-php
others with their CakePHP related questions.