

Photon: high performance PHP/Mongrel2/ZeroMQ micro framework - bpierre
http://www.photon-project.com/

======
andrewvc
If you find this interesting, you might also be interested in DripDrop(
<https://github.com/andrewvc/dripdrop> ), which is an alternate approach to
the fusion of ZeroMQ, HTTP, and WebSockets.

It's not a general purpose web server, but targets message passing
applications that must move between transports. For instance Browser <-> Web
Socket <-> ZMQ is easily possible in it.

It's based on ruby eventmachine (no external daemons needed), and lets you
seamlessly pass messages between all three protocols, leveraging the
differences of each in interesting ways.

Additionally, it's got tools to help you build isolated components that
communicate via messaging only (preferably ZMQ). If you keep this in mind from
the start, it can substantially help when it comes to scaling out.

Lastly, we're working on Mongrel2 support as a front end.

~~~
LoicProcrast
I don't know DripDrop (nice name), but messaging is really the way to go. For
example with Photon or any system really embracing the message passing
approach of Mongrel2, you can get an HTTP request and send back an answer to
other connection over jsSocktet (real time analytics for example) or even
directly into an HTTP stream (chunked encoding in long polling).

The flexibility to easily address a message to a given connection from
everywhere at the backend level is what is wonderful in the protocol developed
by Zed.

------
wildmXranat
Well it just so happens that I think ØMQ and Mongrel 2 are to praise here.
Yes, having a thin wrapper around Mongrel's backend api helps as well, but you
can't compare it to Symfony or Zend unless it's run tested with all features
of a regular application. Db, Auth, Sessions etc.

edit: same goes to tests on symfony's site. We've been using Symfony since pre
1.0 days and you'll be lucky to hit 25% of these request rates once you use
most of the common features.

~~~
trebor
However, beneath the benchmarks it does remind the reader that benchmarks are
arbitrary.

------
j2d2j2d2
I have also started a framework called brubeck for using python's eventlet for
coroutines for message routing / processing.

<https://github.com/j2labs/brubeck>

I have the proof of concept, which is more minimal as a project I'm calling
mongrevent.

<https://github.com/j2labs/mongrevent>

Mongrevent has better documentation for how the interaction with Mongrel2 /
ZeroMQ works.

------
deweller
For those looking to try this out, be aware that this framework appears to be
in a pre-alpha state. Don't expect to download it and expect a working demo
without digging into the code and figuring some stuff out on your own.

With that said: Great work on an innovative framework. I applaud the effort so
far.

------
deweller
Can I use this stack with Socket.IO in the browser for real-time communication
on port 80 to PHP?

In other words, can I implement a simple real-time chat demo using websockets
with this stack?

~~~
LoicProcrast
Yes, in 30 lines of code: <http://tinyurl.com/chat-server-photon>

As Photon is an application server, this means you can do what you do easily
with Django/RoR or a Java application server. This breaks the traditional one
request, one reply, we forget everything approach of PHP. This is now possible
rather nicely as PHP has improved a lot with respect to memory management in
the last releases.

Disclaimer, I am the author of Photon and I am locked out of HackerNews with
my normal account because of the great anti procrastination mode :-D

~~~
deweller
Very nice.

Doesn't the Mongrel2 Chat demo use Flash-based socket communication?

I've haven't been able to figure out if Mongrel2 supports native websocket
communications on the same port as http traffic (a la nodejs with Socket.IO).

~~~
Loic
Yes, here this is jsSocket with the little flash stuff to bring socket support
to all browsers. WebSocket is coming soon into Mongrel2 (the protocol change
delayed a bit the implementation).

------
rbanffy
Wasn't Photon the QNX GUI stack?

edit: yes <http://www.qnx.com/products/hmi/photon.html>

------
jkmcf
I've been hoping to see more projects using mongrel2.

As ugly and inconsistent as the PHP language is, this project is really cool.

