[PHP] PHP as Application Server

2012-09-26 Thread Maciej Liżewski
Hi,

Maybe this topic have been already on board, but I could not find nothing
in google, so my question to PHP maintaneers (and other users too) is:

Why there is no possibility to run PHP in application server way among
other SAPI modules and other possibilities to run PHP? PHP would encounter
great performance boost and became more enterprise :) Just look at Ruby
which is slow as hell compared even with PHP.

By application server I mean scenario when there is statefull application
on server side not only by session mechanizms but all classes definitions
maintained in memory (no need to load class definition on every request),
static class members (and their changes) persistent, background threads,
etc. This way any op-code cachers won't be necessary...

sounds great, huh? others have it already, so why doesn't PHP? are there
any cons? problems too hard to solve (one can be memory leaks, thread safe
coding, etc)? I mean it - I am realy curious why there is no such
possibility and is there any hope we could get it?

TIA for any answers on this topic.


Re: [PHP] PHP as Application Server

2012-09-26 Thread shiplu
My recent experience is PHP eats more memory. But it matters when you are
running it under memory constraint device. For a high end server its not a
matter.
I built an chat server using socket functions which was intended to run on
embedded device. I didn't want to load apache. So I wrote it in plain PHP
(as I am good at it). The server was working good until I my memory runs
out. My memory requirement was really low, about 32M. Thats the total
memory for everything. I ran a heavy RIA chat application with. Later I
change the language to non-PHP (name of that language might start
flame-war). Now its working well so far.

One thing I know is, If you want to do it, you can do it. It'll need some
effort but still doable. Performance optimization comes after development.
So you can have your high performance enterprise application server.

-- 
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader


Re: [PHP] PHP as Application Server

2012-09-26 Thread Daniel Brown
On Wed, Sep 26, 2012 at 5:58 AM, Maciej Liżewski
maciej.lizew...@gmail.com wrote:

 Why there is no possibility to run PHP in application server way among
 other SAPI modules and other possibilities to run PHP? PHP would encounter
 great performance boost and became more enterprise :) Just look at Ruby
 which is slow as hell compared even with PHP.

 By application server I mean scenario when there is statefull application
 on server side not only by session mechanizms but all classes definitions
 maintained in memory (no need to load class definition on every request),
 static class members (and their changes) persistent, background threads,
 etc. This way any op-code cachers won't be necessary...

 sounds great, huh? others have it already, so why doesn't PHP? are there
 any cons? problems too hard to solve (one can be memory leaks, thread safe
 coding, etc)? I mean it - I am realy curious why there is no such
 possibility and is there any hope we could get it?

While there are no real plans to incorporate a full-fledged
application server at this time, PHP 5.4 does have an embedded
server[1] for development and such.  It's certainly not advisable to
use it for production, but the fact is, it's there.

 With regard to an actual production-worthy application server,
you might be interested in HipHop[2], which was developed by some of
the engineers over at Facebook.

^1: http://php.net/manual/en/features.commandline.webserver.php
^2: 
https://developers.facebook.com/blog/post/2010/02/02/hiphop-for-php--move-fast/

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php