Node.js or Photon
- alex knol
- 2011-05-09 @ 22:10
Being a Symfony developer I was looking at version 2 for future projects.
SInce so many things changed from SF1.4 to SF2, my current SF knowledge is
little or no asset in moving into SF2. So, I thought I'd give other (new)
technologies a go as well. Now I've seen the speed comparison between SF2
and photon, which impressed me a lot. Has anyone compared Node.js to photon
Either way, I intent to build a small REST server in both node.js
(+expressJs) and in Photon to learn both and compare performance.
p.s. anybody have an idea of the how many devs are using photon at the
Movil: +34 693 206 868
Company: Pumiwex S.L.U.
PostBox: Apartado Correos 842, Camarles
Delivery / Fiscal: Plaza Don Diego de Leon 3, Camarles (Tarragona)
Postal Code: 43894
Country: Espana Pumiwex S.L.
On Mon, May 9, 2011 at 11:03 AM, Loic d'Anterroches <email@example.com> wrote:
> > Maybe a stupid question, but I just discovered Photon-project. I ike the
> > concept and like to start hacking around with it.
> > Can someone give me some hints on where / how to tie in the mongodb
> > Is there a short tutorial somewhere out there?
> Not really. This comes from my experience with Django, many frameworks,
> writting an ORM and complex web applications. I basically found that the
> current MongoDB driver is good enough to be used "directly". That is,
> you just put your connection data in your config file:
> return array( ...
> 'mongo_dsn' => 'connection-string',);
> and in yyour code, you get the value directly:
> $conn = new \Mongo(Conf::f('mongo_dsn', 'mongodb://localhost:27017'));
> Some people are fans of the doctrine ORM, other like MySQL raw, etc. To
> avoid issues, you can see that for everything in the core framework
> which requires a storage, I am providing a clear interface and 2 ways to
> store the data (usually file + memory). The goal is to be really
> database independant.
> Of course usage patterns will emerge, after 5 projects using MongoDB, I
> will start to have a collections of tools to do the usual things, I will
> then bundle them in an app to easily reuse them.
> My goal is really to keep Photon itslef database independant (but it is
> of course fine to create a mongodb or mysql only solution using Photon).
> I hope it helps, do not hesitate to ask more questions if you have some.
> Indefero - Project management and code hosting - http://www.indefero.net
> Photon - High Performance PHP Framework - http://photon-project.com
> Céondo Ltd - Web + Science = Fun - http://www.ceondo.com
> > Best Regards,
> > Alex Knol
> > Movil: +34 693 206 868
> > Company: Pumiwex S.L.U.
> > PostBox: Apartado Correos 842, Camarles
> > Delivery / Fiscal: Plaza Don Diego de Leon 3, Camarles (Tarragona)
> > Postal Code: 43894
> > Country: Espana Pumiwex S.L.
> > CIF B43969187
> > On Mon, May 2, 2011 at 10:37 AM, William MARTIN <firstname.lastname@example.org
> > <mailto:email@example.com>> wrote:
> > Hi again,
> > This patch add "hnu pot" command to generate POT file for all
> > installed application.
> > I think the code must be review and improve, but it's a good working
> > start point.
> > http://projects.ceondo.com/p/photon/issues/662/
> > William MARTIN
Re: [photon.users] Node.js or Photon
- Loic d'Anterroches
- 2011-05-10 @ 08:25
On 05/10/2011 12:10 AM, alex knol wrote:
> Being a Symfony developer I was looking at version 2 for future
> projects. SInce so many things changed from SF1.4 to SF2, my current SF
> knowledge is little or no asset in moving into SF2.
This is a bit sad to read this. I have not been following the
development of the new Symfony but as the system is fundamentally a thin
layer on top of the PHP SAPI (that is one request, one answer) I am
surprised Fabien went a completely different way.
> So, I thought I'd
> give other (new) technologies a go as well. Now I've seen the speed
> comparison between SF2 and photon, which impressed me a lot. Has anyone
> compared Node.js to photon yet?
I am using both in production, so, let me try to explain the differences
as I know them.
First, for the performance, you can for both of them hit about 8000
req/s on a good server on a single core. This is basically the I/O limit
of a server at the moment (the cost of creating the sockets) for a small
hello world application.
Node.js is a single process multithread server running your code with a
callback approach. Photon is a multiprocess server running your code
following a traditional PHP approach with some nice things like
So, Node.js will not scale naturally on multicore (at the moment, I am
sure it will come) but Photon does it naturally.
For complex applications, I prefer Photon because of Mongrel2 and
ZeroMQ. With ZeroMQ, you can easily access another small service written
in C for performance (or because the code is already available in C) or
> Either way, I intent to build a small REST server in both node.js
> (+expressJs) and in Photon to learn both and compare performance.
For the performance, you will not see a lot of differences, on a
multicore system Photon will be faster, but anyway, as both can saturate
your network I/O before the CPU, I suggest you to compare the
programming style. For example you can use Doctrine with Photon, you do
not have to handle the callback spaghetti effect.
> p.s. anybody have an idea of the how many devs are using photon at the
We are a bit of the underdog at the moment, but all the people coding
with have many years of experience with other frameworks and other
languages, which makes the conversation really nice. You will get good
answers to your questions.
Also, with Node.js, you need a large community because every single
piece of software you will use need to be "Node.js compliant" that is,
non blocking (no imagemagick directly in for example). For Photon, you
can reuse all the exisint PHP libs.
You are welcome to keep asking questions here and I will happily answer