Re: [photon.users] share variable references amongst photon server instances
- Loic d'Anterroches
- 2011-08-23 @ 08:10
On 08/22/2011 07:36 PM, christian calloway wrote:
> I'd like to create "truly" persistent data objects (that is, they would
> persist between requets w/o serialization & re-instantiation), that
> would be shared amongst N photon server instances. Is it
> possible/probable? Would this be better suited to a background task?
A Photon server is basically a set of handlers, each one being a single
process. To be able to share between the processes you need a shared
memory segment of some sort or effectively a small background task.
If your operations on the object are fast, just create a small task like
the Chat example. You can consider it like a small memcache daemon
storing PHP objects where you can easily have additional logic.
The extra "bonus point" in going this way is that you can push this task
on another server the day you want (just change the zeromq end point)
and even if you are single threaded on a single core for each task
(single PHP process) you can easily reach 8000 req/s per core on modern
hardware for a task over zeromq. That is, if you are not Google or
Twitter, it will bring you a long way before you need to use a different
Here to help if you need,