[FLOW3-general] FLOW3 Background Service / Daemon

Manuel Strausz tminus at bitmap.co.at
Sun Aug 8 18:36:00 CEST 2010


Am 04.08.2010 11:59, schrieb Thomas Fritz:
> What do you think about that idea?
>
> Kind regards

Hey,

I think it's a pretty interesting idea. But there might be more problems 
to this approach than meets the eye; PHP has (by it's very nature) a 
share-nothing approach for every singular process that is started (by 
Apache or otherwise).

By making background services you essentially share the data of any 
framework components that you chose to start in the background. With the 
obvious benefits of that approach come all the pitfalls of parallel 
programming.

I guess if you could program it in such a way that the components get 
loaded once (by the first process), and all the data is stored as an 
invariant in memory after that, you shouldn't have too many problems. I 
can see this working very well for stuff like reflection.

But: the reflection data is already cached. The only benefit I see right 
there is that you don't actually have to instantiate the cache manager, 
and the reflection service, since it's already running.
But the big bottleneck would be more in actually performing the 
reflection, which only has to be done once at this point (until the 
class is changed anyway). So while this would indeed improve performance 
a bit, I'm not sure it's worth the effort right now.

Since you can configure the cache to use in-memory storage e.g. with APC 
or memcached, which already is a background process, we're already 
half-way there anyway. It's all about caching with these modern approaches.

By the way, slightly off-topic, but when testing serveral FLOW3 
components with a rather big project (around 300 classes) I noticed that 
the reflection cache was actually getting so big that it would take 
almost a second just to unserialize the cache.
One way to work around this problem (that I actually implemented as a 
test version) is to have one reflection cache per controller, which only 
caches the reflection for the classes used in that controller. I think 
FLOW3 definitely needs to consider that when we finally see real-life 
projects with a lot of classes.

So, as I said I think background services could have it's uses but I 
think caches solve much of the same problem domain. I could be wrong 
though since I never actually tried anything like that :)

kind regards (und schöne grüße aus Wien ;)),

Manuel


More information about the FLOW3-general mailing list